如何使用R获得精确的国家地图

时间:2013-10-09 07:55:38

标签: r map plot country

我经常去网站: http://gadm.org 找到我想用R绘制的国家的轮廓 但今天,这个网站已关闭,我不知道如何继续制作一张非常准确的地图...

当我尝试:

library(maps)
map("world", xlim=c(15,23), ylim=c(45.5,49))

这个国家的轮廓不是很准确......

我试图找到一个可以给出轮廓的其他网站,但我找不到。

有人可以帮助我吗?

1 个答案:

答案 0 :(得分:5)

好吧,假设您想使用来自Natural Earth的数据绘制法国轮廓:

# First download the data in your working directory
download.file("http://www.naturalearthdata.com/http//www.naturalearthdata.com/download/10m/cultural/ne_10m_admin_0_countries.zip", "countries.zip")
# Then unzip
unzip("countries.zip")
# Load maptools
library(maptools)
# Read in the shapefile
world <- readShapeSpatial("ne_10m_admin_0_countries.shp")
# Plot France
plot(world[world$ADMIN=="France",1]) 
# Column 1 is the id column, column "ADMIN" contains the country names