The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.

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()

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.