Mappa
Mappa copied to clipboard
Mapbox custom styles not working with staticMap()
setting as option style:mapbox://styles/username/mapid
mappa.js will load this url:
https://api.mapbox.com/styles/v1/mapbox/mapbox://styles/username/mapid/static/0,0,1,0,0/640x640?access_token=XYZ
According to documentation, the correct url should be:
https://api.mapbox.com/styles/v1/username/mapid/static/0,0,1,0,0/640x640?access_token=XYZ
great, will fix. thanks!
@mikima, you can work around this in the current release by setting a username and style id in your options:
options = {
username: 'pzhine',
style: 'cjoyiufdc3zhi2smr3ws3upbr',
lng: 2.147821,
lat: 41.373632,
zoom: 10.9,
scale: 1,
pitch: 0,
},
Note that these options will probably not work with mappa.tileMap(options)
, because this relies on the mapbox://styles/username/mapid
format for the style
field. It would probably be a good idea to normalize these.
@pzhine thanks but with the latest version I thought the bug was solved, indeed just setting the mapbox://styles/username/mapid
style it works now. Tested with the latest version of mappa (commit 551e2c9).