As I did multiple times, I am trying to import a map of Cyprus using the ggmap function in R:
library("ggmap")
library("ggsn")
leftCY = 412259.3; bottomCY = 3811795;
rightCY = 454399.3; topCY = 3837195;
RHO_map <- get_stamenmap(bbox = c(left = leftCY,
bottom = bottomCY,
right = rightCY,
top = topCY),
zoom = 10,
maptype = "terrain")
However, I get the following error:
Error in curl::curl_fetch_memory(url, handle = handle) :
Could not resolve host: tile.stamen.com
I have checked my internet connection and everything is fine. I have seen in some web links Error in curl::curl_fetch_memory(url, handle = handle) with ggmap package
that Tiles are now hosted by Stadia (and require API key) and that I should install from github: remotes::install_github("dkahle/ggmap"). I have installed remotes package, run the suggested command, and rerun the command:
RHO_map <- get_stamenmap(bbox = c(left = leftCY,
bottom = bottomCY,
right = rightCY,
top = topCY),
zoom = 10,
maptype = "terrain")
But I still get the same error, and I am stuck. Is there any suggestion or alternative?
According to the guidelines of stadia website: https://docs.stadiamaps.com/guides/migrating-from-stamen-map-tiles/
I have created an API key by registering to (free, check video https://www.youtube-nocookie.com/embed/6jUSyI6x3xg) , and I have run the following command
and it worked.
Additional comment: Be aware that ggsn is not working with newest R versions, so you need to find alternatives for scalebars and north arrow (now I am facing this problem).