dkahle / ggmap

A package for plotting maps in R with ggplot2
763 stars 231 forks source link

"Error in gzfile(file, "rb") : cannot open the connection" get_map filename download issue? #347

Open SimonDedman opened 1 year ago

SimonDedman commented 1 year ago

For get_map / get_googlemap my (Mac) friend gets this error:

Error in gzfile(file, "rb") : cannot open the connection
In addition: Warning message:
In gzfile(file, "rb") :
  cannot open compressed file '/var/folders/dl/4l7n6kz96_1c18vhwrgx90740000gn/T//RtmpZyYp5f/ggmap/index.rds', probable reason 'No such file or directory'

The/ggmap folder has been created (suggesting R/Rstudio/ggmap has permission to write there).

Someone having a similar issue said it might be due to filename length (maybe adding the tile files and the index.rds would have exceeded a limit) but there's no way to verify this because it's not possible to change the download location of tile files and the index (see issue).

When I run the same code:

myMap <- ggmap::get_map(
location = c(-64.726720, 32.348871),
zoom = 16,
source = "google",
maptype = "satellite",
crop = TRUE,
filename = "/home/simon/Desktop/MAP")

on my linux system it works fine. AND it worked fine for her before. Her API key seems to work. Any ideas welcome. Thanks.

JeremyLGauthier commented 3 months ago

I had the same problem at one point and a restart of Rstudio solved it. Hope this helps...