我正在尝试使用 ggplot2 绑定美国和加拿大的人口普查地图。
us <- readOGR(dsn = "00-raw/usmaps/us/", layer = "co99_d90")
canada <- readOGR(dsn = "00-raw/gcd_000b11a_e/", layer = "canada")
canada$id <- as.numeric(canada$id)
us$id <- as.numeric(us$id)
canada$id <- canada$id + length(unique(us$id))
na <- rbind(canada, us)
p <- ggplot() +
geom_polygon(data = na, aes(x = long, y = lat, group = group, fill = pop),
color = "black", size = 0.25) +
theme_nothing(legend = TRUE)
但是有一些奇怪的线。
shapefile 的来源如下:
http://www12.statcan.gc.ca/census-recensement/2011/geo/bound-limit/files-fichiers/gcd_000b11a_e.zip
www2.census.gov/geo/tiger/PREVGENZ/co/co90shp/co99_d90_shp.zip
我真的需要这些 shapefile,因为我希望我的边界代表美国的县和加拿大的人口普查部门。