如何自定义地图geojson数据

在工作中我们可能会遇到一些需求,需要某些特定的地图,并且在地图上要加一些特殊的标记.

获取指定区域的地图

https://datav.aliyun.com/tools/atlas/index.html

可以选择指定区域的地图,精确到区,这个网站的geo数据更新比较及时,21年杭州区划变更以后,数据也得到了更新.

img

复制对应的 json数据.

格式类似如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"properties": {
"adcode": 330110,
"name": "余杭区",
"center": [
119.978959,
30.27365
],
"centroid": [
119.914653,
30.36723
],
"childrenNum": 0,
"level": "district",
"acroutes": [
100000,
330000,
330100
],
"parent": {
"adcode": 330100
}
},
"geometry": {
"type": "MultiPolygon",
"coordinates": [
[
[
[
120.129337,
30.38264
],
[
120.129201,
30.382786
]

画点

复制json数据到geojson.io,

img

img

最后把修改后的json复制保存,到echart或者datav等实用即可.

thank u !