Mappa icon indicating copy to clipboard operation
Mappa copied to clipboard

Mapbox custom styles not working with staticMap()

Open mikima opened this issue 6 years ago • 3 comments

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

mikima avatar May 03 '18 11:05 mikima

great, will fix. thanks!

cvalenzuela avatar May 04 '18 00:05 cvalenzuela

@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 avatar Nov 26 '18 17:11 pzhine

@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).

mikima avatar Nov 27 '18 14:11 mikima