hypertidy/ceramic

custom styles

mdsumner opened this issue · 5 comments

I'm trying strings like

"https://api.mapbox.com/styles/v1/mdsumner/cjs6yn9hu0coo1fqhdqgw3o18/wmts/{zoom}/{x}/{y}.jpg90?access_token=???"

Where "mdsumner/cjs6yn9hu0coo1fqhdqgw3o18" is the custom style. It not working, checked at zoom = 2, 5.

Any clues? @shermstats

Mapbox tells me to use "https://api.mapbox.com/styles/v1/mdsumner/cjs6yn9hu0coo1fqhdqgw3o18/wmts?access_token=etc" but no more I can find about the rest of the string

The custom style is just cjs6yn9hu0coo1fqhdqgw3o18, not mdsumner/cjs6yn9hu0coo1fqhdqgw3o18 prefixed with your username.

Also, trycjs6yn9hu0coo1fqhdqgw3o18/tiles/ instead of cjs6yn9hu0coo1fqhdqgw3o18/wmts/. And maybe try removing the .jpg90? I've never used that in my code.

Thanks! Still can't get it ... do you have a specific link to a tile that works so I can trace through?

Got it. You can't specify the format afaics, always JPEG

https://api.mapbox.com/styles/v1/mdsumner/cjs6yn9hu0coo1fqhdqgw3o18/tiles/512/0/0/0@2x?access_token=...

Veeery tentatively, this works in 9a8fe43:

u <- "https://api.mapbox.com/styles/v1/mdsumner/cjs6yn9hu0coo1fqhdqgw3o18/tiles/512/{zoom}/{x}/{y}"
 im <- cc_location(cbind(147, -42), base_url = u)
raster::plotRGB(im)

image

It's pretty hacky because I have to special-case the code for the file extension, presumably there's a better way to do it, but it was nice having an explicit extension because then tile source URLs mapped directly to local file names. (though the @2x thing messes that up)

apparently custom styles assume to be PNG, re https://twitter.com/neilcharles_uk/status/1121372303533707264 so take care