数据一直是科学研究绕不开的话题,为了方便快捷的获取各种地理数据,许多R包被开发出来,今天介绍一些方便快捷的数据R包。
rnaturalearth 包使 Natural Earth 数据可用。自然地球特征包括 1:10m、1:50m 和 1:1.1 亿比例尺的海岸线、河流、测深、政治边界、公路和铁路。下面我们使用这个包来获取国家边界数据:
library(rnaturalearth)
library(sf)
usa = ne_countries(country = "United States of America")
plot(usa_sf)
当然,我们可以使用这些数据做做一些更好看的地图,例如不同比例尺的地图,代码如下:
library(ggplot2)
#world map
world <- ne_countries(scale = 110)
small_scale_map <- ggplot() +
geom_sf(data = world) +
coord_sf(xlim = c(-20, 50), ylim = c(33, 80)) +
ggtitle("Europe")
install.packages("rnaturalearthdata")
# europe map
europe <- ne_countries(scale = 50, continent = "Europe&#