readPNG错误:ggmap和Stamen Maps

时间:2021-07-29 07:00:38

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

我一直收到此错误readPNG(destfile)错误:libpng错误:PLTE:CRC错误,代码如下:

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.

有任何想法吗?我觉得这可能是Stamen地图而不是ggmap的问题。如果是这样,我会把它带给他们。

1 个解决方案

#1


1  

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.

文件ggmapTemp.png是由工作目录中的ggmap生成的,但我不知道它是如何涉及的。

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

我使用的是R版本2.15.0,ggplot2版本0.9.1和ggmap版本2.1

readPNG错误:ggmap和Stamen MapsreadPNG错误:ggmap和Stamen Maps

#1


1  

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.

文件ggmapTemp.png是由工作目录中的ggmap生成的,但我不知道它是如何涉及的。

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

我使用的是R版本2.15.0,ggplot2版本0.9.1和ggmap版本2.1

readPNG错误:ggmap和Stamen MapsreadPNG错误:ggmap和Stamen Maps