getmap | R Documentation |
Get the map data at province, city or district level
getmap(adcode, level = "default")
adcode |
The administrative code |
level |
The level of map data, including province, city and district |
sf data
## Not run: library(ggplot2) # China map # (1) China map at province level china <- getmap(adcode = 100000, level = "province") ggplot(china) + geom_sf(fill = "white") + theme_bw() # (2) China map at city level china <- getmap(adcode = 100000, level = "city") ggplot(china) + geom_sf(fill = "white") + theme_bw() # (3) China map at district level china <- getmap(adcode = 100000, level = "district") ggplot(china) + geom_sf(fill = "white") + theme_bw() # (4) missing value in the argment "level" china4 <- getmap(adcode = 100000) ggplot(china) + geom_sf(fill = "white") + theme_bw() # Sichuan # (1) map at province level sichuan <- getmap(adcode = 510000, level = "province") ggplot(sichuan) + geom_sf(fill = "white") + theme_bw() # (2) map at city level sichuan <- getmap(adcode = 510000, level = "city") ggplot(sichuan) + geom_sf(fill = "white") + theme_bw() # (3) map at district level sichuan <- getmap(adcode = 510000, level = "district") ggplot(sichuan) + geom_sf(fill = "white") + theme_bw() # Chengdu # (1) map at city level chengdu <- getmap(adcode = 510100, level = "city") ggplot(chengdu) + geom_sf(fill = "white") + theme_bw() # (2) fetch and map at district level chengdu <- getmap(adcode = 510100, level = "district") ggplot(chengdu) + geom_sf(fill = "white") + theme_bw() ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.