0

I have a R shiny app that successfully uses leaflet to interact with a custom mapbox studio style.

mapbox_url = "https://api.mapbox.com/styles/v1/bweinstein/ck94nmzn20an31imrz6ffplun/tiles/256/{z}/{x}/{y}@2x?access_token=####"
leaflet() %>% addTiles(mapbox_url)

To do this I

  1. Uploaded tileset to mapbox
  2. Created a new style and added the tileset as a source
  3. Click share in studio and got the CARTO link (as in https://stackoverflow.com/questions/34072237/how-can-i-use-a-custom-created-mapbox-style-along-with-leaflet)

Is there anyway to programmatically create styles, or better yet, directly get the tileset without studio? Studio styles have a limit of 15 sources. I have hundreds of tiles that I'd like to programmatically choose in my app.

Expected behavior

If I have a tileset with the id

bweinstein.CypressCity_03_25_2020

I expected the tileset to be available at url:

mapbox_url = 'https://api.mapbox.com/styles/v1/bweinstein/bweinstein.CypressCity_03_25_2020/tiles/256/{z}/{x}/{y}@2x?access_token=####'

I've tried a number of variants, e.g.

mapbox_url = 'https://api.mapbox.com/styles/v1/bweinstein/CypressCity_03_25_2020/tiles/256/{z}/{x}/{y}?access_token=####'

I don't see anything here: https://docs.mapbox.com/studio-manual/overview/publish-your-style/#leaflet but this seems like a core use-case?

Edit

The answer Using Mapbox tiles with folium from 2016 uses classic mapbox API and appears deprecated.

MacBook-Pro:Downloads ben$ curl http://{s}.tiles.mapbox.com/v4/bweinstein.CypressCity_03_25_2020/{z}/{x}/{y}.png?access_token=#####
curl: (6) Could not resolve host: s.tiles.mapbox.com

Current tileset API cannot find it

MacBook-Pro:Downloads ben$ curl http://api.mapbox.com/v4/bweinstein.CypressCity_03_25_2020/{z}/{x}/{y}.png?access_token=######
{"message":"Not Found"}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.