简体   繁体   中英

readPNG error: ggmap and Stamen Maps

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.

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

在此处输入图片说明在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM