Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error trying to add API key #29

Open
johnrharley opened this issue Sep 12, 2023 · 0 comments
Open

Error trying to add API key #29

johnrharley opened this issue Sep 12, 2023 · 0 comments

Comments

@johnrharley
Copy link

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”
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant