[Xastir] Using Mapbox maps on Xastir

Tom Russo russo at bogodyn.org
Wed May 13 10:40:45 EDT 2015


On Wed, May 13, 2015 at 10:07:32AM -0400, we recorded a bogon-computron collision of the <eric at christensenplace.us> flavor, containing:
> On Tuesday, May 12, 2015 08:30:44 PM Hal Mueller wrote:
> > What???s the exact URL you???re passing? 
> 
> I tried using this one:
> > https://a.tiles.mapbox.com/v4/sparks.m5kmpi20/10/288/402@2x.png?access_token
> > =pk.eyJ1Ijoic3BhcmtzIiwiYSI6ImZoamk1dmMifQ.WS_WgruA82kmVWgZP_GgcQ then I see
> > an image tile.
> 
> ...but it timed out.  Then I was thinking that I'm not sure how Xastir would 
> know how to get the tiles around this tile (maybe it does?) and so I started 
> messing with the URL making it also not work.

Xastir knows how to generate the X/Y/Zoom/image.png part of the URL if it
is given the right base URL in a .geo file (use OSM_tiled_mapnik.geo as a 
pattern).  

But it knows nothing about adding the token string to this URL.  That would
have to be done with code modification.  You cannot get Xastir to do 
general tile fetching with the access token without doing code modification, 
even if you could figure out how to force it to load a single tile as you are
attempting to do.

The code that constructs the complete tile URL from the base URL is in
tile_mgmnt.c, down around line 200 in the function "getOneTile".  In order
to add access token to the URL, you'd have to hack on the code in 
map_geo.c to support a token keyword in the .geo file, and hack on the 
getOneTile code to support sticking the "?access_token=...." at the end
before doing the fetch.

Alternatively, one could possibly hack on the .geo code to let the URL
be a "printf" format instead of a raw string, and the printf in tile_mgmnt.c
use that format to fill in the zoom, x, and y parts.  What follows below
is a rough sketch of what would have to be done, after just  quick glance at
the source code.

The current way it's done in tile_mgmnt.c is to construct the tile URL
like this:

    xastir_snprintf(url, sizeof(url), "%s/%u/%lu/%lu.%s", baseURL, zoom,
            x, y, tileExt);

And for OSM_tiled_mapnik the .geo file has:
  URL http://tile.openstreetmap.org/

If the .geo code were adapated to support a format as well as a base url, and 
this were changed to:
  URL_format http/tile.openstreetmap.org/%u/%lu/%lu.png

and getOneTile changed to do:
    xastir_snprintf(url, sizeof(url), baseURLFormat, zoom, x, y);

it would accomplish the same thing, but allow for more server-specific 
tricks like adding an access token.

This would be like work, but if you wanted to try to make it happen, that's
where you'd have to go.  And it still might not work if mapbox is going to
great lengths to prevent unauthorized clients from accessing their maps.

Because Xastir is designed to work only from free map sources, it is unlikely
that code to access paid subscription services would be added to the official
code base.

-- 
Tom Russo    KM5VY   SAR502   DM64ux          http://www.swcp.com/~russo/
Tijeras, NM  QRPL#1592 K2#398  SOC#236        http://kevan.org/brain.cgi?DDTNM
 echo "prpv_a'rfg_cnf_har_cvcr" | sed -e 's/_/ /g' | tr [a-m][n-z] [n-z][a-m]


More information about the Xastir mailing list