cnmap

Panfeng Zhang

2025-09-11

Installation

Install the latest CRAN release via command:

install.packages("cnmap")

According to the code or the name of the administrative division at the county level and above provided by the Ministry of Civil Affairs of the People’s Republic of China in 2022, get the map file of online from the website http://datav.aliyun.com/portal/school/atlas/area_selector.

Usage 1

library(ggplot2)
library(sf)
## Linking to GEOS 3.13.1, GDAL 3.11.0, PROJ 9.6.0; sf_use_s2() is TRUE
library(cnmap)

map1 <- getMap(name = "中国")
ggplot(data = map1) + geom_sf()

Usage 2

# code and name: https://www.mca.gov.cn/mzsj/xzqh/2022/202201xzqh.html
map2 <- getMap(code = "100000", subRegion = TRUE) 
ggplot(data = map2) + geom_sf()

Usage 3

map3 <- getMap(name = "吉林省", subRegion = TRUE)
ggplot(data = map3) + geom_sf()

Usage 4

map4 <- getMap(name = "长春市", subRegion = TRUE)
ggplot(data = map4) + geom_sf()

Usage 5

map5 <- getMap(code = "220100", subRegion = TRUE) 
ggplot(data = map5) + geom_sf()

map4 is equivalent to map5.

Usage 6

map6 <- getMap(name = "香港特别行政区", subRegion = TRUE)
ggplot(data = map6) + geom_sf()

mirror server hosted at Truenetwork, Russian Federation.