是否可以在R中读取geoJSON或topoJSON文件来绘制Choropleth映射? [英] Is it possible to read geoJSON or topoJSON file in R to draw a choropleth map?
本文介绍了是否可以在R中读取geoJSON或topoJSON文件来绘制Choropleth映射?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
topoJSON
和geoJSON
文件在Internet上绘制地图非常普遍.是否可以将它们导入R
来绘制Choropleth映射?
topoJSON
and geoJSON
files are know very common for drawing maps on the internet. Is it possible to import them in R
to draw choropleth maps?
推荐答案
获取安装的rgdal
软件包.然后,如果:
Get the rgdal
package installed. Then if:
library(rgdal)
> "GeoJSON" %in% ogrDrivers()$name
[1] TRUE
然后您可以执行以下操作:
then you can do something like:
> map = readOGR("foo.json", "OGRGeoJSON")
> plot(map)
但是您需要ogrDrivers
列表中的GeoJSON支持.
But you need GeoJSON support in your ogrDrivers
list.
这篇关于是否可以在R中读取geoJSON或topoJSON文件来绘制Choropleth映射?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文