3
votes

I keep getting this error Error in readPNG(destfile) : libpng error: PLTE: CRC error with the following code:

map <- get_map(location='Auckland', source="stamen", maptype="toner", zoom=11)
ggmap(map)

This does works however:

map <- get_map(location='Auckland', source="stamen", maptype="toner", zoom=13)
ggmap(map)

Any ideas? I get the feeling that this may be an issue with Stamen maps rather than ggmap. If so, I will take it to them.

1

1 Answers

1
votes

I can get the two maps, but not consistently. If I get an error, I run the code a second or a third time to get the maps drawn. I don't think it's got anything to do with zoom levels. Nothing systematic, but I get the same error message with other zoom levels; even the same zoom level in the two maps.

The error message I get is:

  Error in download.file(urls[[k]], destfile = destfile, quiet = !messaging,  : 
     cannot open destfile 'ggmapTemp.png', reason 'Permission denied'

The file, ggmapTemp.png, is generated by ggmap in the working directory, but I don't know how it is involved.

I ran the following code to draw the two maps:

library(ggmap)
map <- get_map(location='Auckland', source="stamen", maptype="toner", zoom=11)
ggmap(map)
windows()
map <- get_map(location='Auckland', source="stamen", maptype="toner", zoom=13)
ggmap(map)

I'm using R version 2.15.0, ggplot2 version 0.9.1, and ggmap version 2.1

enter image description hereenter image description here