You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: vignettes/ShapeMap.Rmd
+44-15
Original file line number
Diff line number
Diff line change
@@ -18,7 +18,7 @@ knitr::opts_chunk$set(
18
18
19
19
### Overview
20
20
21
-
This package provides functions to add choropleth map layers for Chinese cities and provinces to a Leaflet map object. These layers can be customized with various options such as color scales, labels, and popups.
21
+
This package provides functions to add shape map layers for Chinese cities and provinces to a Leaflet map object. These layers can be customized with various options such as color scales, labels, and popups.
22
22
23
23
### Installation
24
24
@@ -29,11 +29,19 @@ This package provides functions to add choropleth map layers for Chinese cities
29
29
30
30
### Usage
31
31
32
-
#### Adding
32
+
#### Adding Amap Tiles
33
+
34
+
```{r}
35
+
library(leaflet)
36
+
library(leafletZH)
37
+
leaflet() %>%
38
+
addTilesAmap() %>%
39
+
setView(lng = 120.33739, lat = 31.13533, zoom = 3)
40
+
```
33
41
34
42
#### Adding a City Layer
35
43
36
-
To add a choropleth map layer for cities, use the addCityShape function. You will need a data frame containing the data to be visualized, including the Chinese administrative division codes (adcode).
44
+
To add a shape map layer for cities, use the addCityShape function. You will need a data frame containing the data to be visualized, including the Chinese administrative division codes (adcode).You can get adcode from `leafletZH::china_city`
37
45
38
46
```{r}
39
47
library(leaflet)
@@ -52,36 +60,57 @@ leaflet() |>
52
60
53
61
#### Adding a Province Layer
54
62
55
-
To add a choropleth map layer for provinces, use the addProvinceShape function. Similar to the city layer, you will need a data frame containing the data to be visualized.
63
+
To add a shape map layer for provinces, use the addProvinceShape function. Similar to the city layer, you will need a data frame containing the data to be visualized.You can get adcode from `leafletZH::china_province`
64
+
65
+
56
66
57
67
```{r}
58
68
library(leaflet)
59
69
library(leaflet.extras)
60
70
library(leafletZH)
61
-
data <- data.frame(name = leafletZH::china_province$name, value = runif(34))
0 commit comments