ZevRoss 博客如下:
http://zevross.com/blog/2014/04/11/using-r-to-quickly-create-an-interactive-online-map-using-the-leafletr-package/
有错误的代码是:
# ----- Write data to GeoJSON
leafdat<-paste(downloaddir, "/", filename, ".geojson", sep="")
writeOGR(subdat, leafdat, layer="", driver="GeoJSON")
错误是:
Error in writeOGR(subdat, leafdat, layer = "", driver = "GeoJSON") :
GDAL Error 3: Cannot open file 'd:/Leaflet/County_2010Census_DP1.geojson'
因为我是R的大一新生,我搜索了很多这个问题,没有得到任何好的答案。
我在 Windows 7 32 位上使用 Rstudio R 版本 3.1.1(2014-07-10)。
我的 rgdal 版本是 0.9-1。
博客中的其他代码运行成功,这句话似乎是唯一的难点。
最佳答案
您可以使用 LeafletR 包创建 GeoJSON:
library('leafletR')
Your_GeoJSON <- toGeoJSON(data=YourData, dest=getwd())
关于r - 我正在尝试根据 ZevRoss 博客使用 LeafletR 包制作交互式 map 。但是代码有错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26031415/