cvalenzuela / Mappa

A canvas wrapper for Maps 🗺 🌍
https://mappa.js.org
359 stars 104 forks source link

Mapbox custom styles not working with staticMap() #17

Open mikima opened 6 years ago

mikima commented 6 years ago

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

cvalenzuela commented 6 years ago

great, will fix. thanks!

pzhine commented 5 years ago

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

mikima commented 5 years ago

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