Error trying to add API key
johnrharley opened this issue · comments
Hi there,
I'm having some trouble adding an API key to access Thunderforest tiles. I'm trying to use ggspatial
, but I found some documentation for adding the api key to rosm
through source_from_url_format()
.
However the function does not seem to allow anything after the extension (".jpg", ".png", etc) so I can't pass the API key to the URL in this way.
This works and allows me to pull tiles using ggspatial::annotation_map_tile()
but does not take the API key, tiles have the watermark on them,
thunderforest = rosm::source_from_url_format(
url_format = c('http://a.tile.thunderforest.com/landscape/${z}/${x}/${y}.png',
'http://b.tile.thunderforest.com/landscape/${z}/${x}/${y}.png',
'http://c.tile.thunderforest.com/landscape/${z}/${x}/${y}.png'),
attribution = "More on Thunderforest at http://www.thunderforest.com/")
This does not work
> thunderforest = rosm::source_from_url_format(
url_format = c('http://a.tile.thunderforest.com/landscape/${z}/${x}/${y}.png?apikey=<myapikey>',
'http://b.tile.thunderforest.com/landscape/${z}/${x}/${y}.png?apikey=<myapikey>',
'http://c.tile.thunderforest.com/landscape/${z}/${x}/${y}.png?apikey=<myapikey>'),
attribution = "More on Thunderforest at http://www.thunderforest.com/")
Error in match.arg(extension, c("png", "jpeg", "jpg")) :
'arg' should be one of “png”, “jpeg”, “jpg”