实现弧度飞线图层需要 地图JS API 和 LOCA数据可视化API 组合实现.
概述-地图 JS API v2.0 | 高德地图API (amap.com)
概述-LOCA 数据可视化 API 2.0|高德地图API (amap.com)
我刚开始引入这个图层进行使用的时候,因为粗心没有细看 LOCA的手册导致一直报错,这里给大家说一下原因:
因为这个弧度飞线图层的演示代码里面引入 api 的方式不同,导致我一时不知道怎么引入,后来仔细看了 LOCA 的示例手册明白.
北京人口流出飞线-弧度飞线图层-示例详情-Loca API 2.0 | 高德地图API (amap.com)
接下来就是完整代码详解:
其中 https://a.amap.com/Loca/static/loca-v2/demos/mock_data/pulselink-china-city-point.json 的数据:
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"properties": {
"type": 0,
"ratio": 0.0369,
"lineWidthRatio": 1
},
"geometry": {
"type": "Point",
"coordinates": [
115.482331,
38.867657
]
}
},
{
"type": "Feature",
"properties": {
"type": 1,
"ratio": 0.035,
"lineWidthRatio": 0.9447674418604651
},
"geometry": {
"type": "Point",
"coordinates": [
117.190182,
39.125596
]
}
},
{
"type": "Feature",
"properties": {
"type": 2,
"ratio": 0.0189,
"lineWidthRatio": 0.47674418604651164
},
"geometry": {
"type": "Point",
"coordinates": [
121.472644,
31.231706
]
}
},
{
"type": "Feature",
"properties": {
"type": 3,
"ratio": 0.0167,
"lineWidthRatio": 0.41279069767441856
},
"geometry": {
"type": "Point",
"coordinates": [
113.280637,
23.125178
]
}
},
{
"type": "Feature",
"properties": {
"type": 4,
"ratio": 0.0148,
"lineWidthRatio": 0.35755813953488375
},
"geometry": {
"type": "Point",
"coordinates": [
106.504962,
29.533155
]
}
},
{
"type": "Feature",
"properties": {
"type": 5,
"ratio": 0.0147,
"lineWidthRatio": 0.35465116279069764
},
"geometry": {
"type": "Point",
"coordinates": [
114.884091,
40.811901
]
}
},
{
"type": "Feature",
"properties": {
"type": 6,
"ratio": 0.0137,
"lineWidthRatio": 0.32558139534883723
},
"geometry": {
"type": "Point",
"coordinates": [
113.746262,
23.046237
]
}
},
{
"type": "Feature",
"properties": {
"type": 7,
"ratio": 0.0136,
"lineWidthRatio": 0.3226744186046511
},
"geometry": {
"type": "Point",
"coordinates": [
104.065735,
30.659462
]
}
},
{
"type": "Feature",
"properties": {
"type": 0,
"ratio": 0.0134,
"lineWidthRatio": 0.3168604651162791
},
"geometry": {
"type": "Point",
"coordinates": [
114.502461,
38.045474
]
}
},
{
"type": "Feature",
"properties": {
"type": 1,
"ratio": 0.0116,
"lineWidthRatio": 0.2645348837209302
},
"geometry": {
"type": "Point",
"coordinates": [
118.175393,
39.635113
]
}
},
{
"type": "Feature",
"properties": {
"type": 2,
"ratio": 0.011,
"lineWidthRatio": 0.24709302325581392
},
"geometry": {
"type": "Point",
"coordinates": [
118.767413,
32.041544
]
}
},
{
"type": "Feature",
"properties": {
"type": 3,
"ratio": 0.0108,
"lineWidthRatio": 0.24127906976744187
},
"geometry": {
"type": "Point",
"coordinates": [
120.153576,
30.287459
]
}
},
{
"type": "Feature",
"properties": {
"type": 4,
"ratio": 0.0101,
"lineWidthRatio": 0.2209302325581395
},
"geometry": {
"type": "Point",
"coordinates": [
116.857461,
38.310582
]
}
},
{
"type": "Feature",
"properties": {
"type": 5,
"ratio": 0.0097,
"lineWidthRatio": 0.20930232558139533
},
"geometry": {
"type": "Point",
"coordinates": [
117.939152,
40.976204
]
}
},
{
"type": "Feature",
"properties": {
"type": 6,
"ratio": 0.0087,
"lineWidthRatio": 0.18023255813953484
},
"geometry": {
"type": "Point",
"coordinates": [
114.490686,
36.612273
]
}
},
{
"type": "Feature",
"properties": {
"type": 7,
"ratio": 0.0081,
"lineWidthRatio": 0.1627906976744186
},
"geometry": {
"type": "Point",
"coordinates": [
113.665412,
34.757975
]
}
},
{
"type": "Feature",
"properties": {
"type": 0,
"ratio": 0.008,
"lineWidthRatio": 0.15988372093023254
},
"geometry": {
"type": "Point",
"coordinates": [
114.085947,
22.547
]
}
},
{
"type": "Feature",
"properties": {
"type": 1,
"ratio": 0.0077,
"lineWidthRatio": 0.1511627906976744
},
"geometry": {
"type": "Point",
"coordinates": [
120.619585,
31.299379
]
}
},
{
"type": "Feature",
"properties": {
"type": 2,
"ratio": 0.0074,
"lineWidthRatio": 0.14244186046511628
},
"geometry": {
"type": "Point",
"coordinates": [
108.948024,
34.263161
]
}
},
{
"type": "Feature",
"properties": {
"type": 3,
"ratio": 0.0074,
"lineWidthRatio": 0.14244186046511628
},
"geometry": {
"type": "Point",
"coordinates": [
117.000923,
36.675807
]
}
},
{
"type": "Feature",
"properties": {
"type": 4,
"ratio": 0.0071,
"lineWidthRatio": 0.13372093023255813
},
"geometry": {
"type": "Point",
"coordinates": [
114.508851,
37.0682
]
}
},
{
"type": "Feature",
"properties": {
"type": 5,
"ratio": 0.0063,
"lineWidthRatio": 0.11046511627906977
},
"geometry": {
"type": "Point",
"coordinates": [
115.665993,
37.735097
]
}
},
{
"type": "Feature",
"properties": {
"type": 6,
"ratio": 0.006,
"lineWidthRatio": 0.10174418604651163
},
"geometry": {
"type": "Point",
"coordinates": [
120.355173,
36.082982
]
}
},
{
"type": "Feature",
"properties": {
"type": 7,
"ratio": 0.0055,
"lineWidthRatio": 0.08720930232558138
},
"geometry": {
"type": "Point",
"coordinates": [
116.307428,
37.453968
]
}
},
{
"type": "Feature",
"properties": {
"type": 0,
"ratio": 0.0055,
"lineWidthRatio": 0.08720930232558138
},
"geometry": {
"type": "Point",
"coordinates": [
112.982279,
28.19409
]
}
},
{
"type": "Feature",
"properties": {
"type": 1,
"ratio": 0.0054,
"lineWidthRatio": 0.08430232558139536
},
"geometry": {
"type": "Point",
"coordinates": [
115.469381,
35.246531
]
}
},
{
"type": "Feature",
"properties": {
"type": 2,
"ratio": 0.0053,
"lineWidthRatio": 0.08139534883720931
},
"geometry": {
"type": "Point",
"coordinates": [
119.107078,
36.70925
]
}
},
{
"type": "Feature",
"properties": {
"type": 3,
"ratio": 0.0051,
"lineWidthRatio": 0.07558139534883722
},
"geometry": {
"type": "Point",
"coordinates": [
123.429096,
41.796767
]
}
},
{
"type": "Feature",
"properties": {
"type": 4,
"ratio": 0.0049,
"lineWidthRatio": 0.06976744186046512
},
"geometry": {
"type": "Point",
"coordinates": [
117.184811,
34.261792
]
}
},
{
"type": "Feature",
"properties": {
"type": 5,
"ratio": 0.0049,
"lineWidthRatio": 0.06976744186046512
},
"geometry": {
"type": "Point",
"coordinates": [
112.549248,
37.857014
]
}
},
{
"type": "Feature",
"properties": {
"type": 6,
"ratio": 0.0048,
"lineWidthRatio": 0.06686046511627905
},
"geometry": {
"type": "Point",
"coordinates": [
113.122717,
23.028762
]
}
},
{
"type": "Feature",
"properties": {
"type": 7,
"ratio": 0.0048,
"lineWidthRatio": 0.06686046511627905
},
"geometry": {
"type": "Point",
"coordinates": [
112.540918,
32.999082
]
}
},
{
"type": "Feature",
"properties": {
"type": 0,
"ratio": 0.0048,
"lineWidthRatio": 0.06686046511627905
},
"geometry": {
"type": "Point",
"coordinates": [
114.649653,
33.620357
]
}
},
{
"type": "Feature",
"properties": {
"type": 1,
"ratio": 0.0047,
"lineWidthRatio": 0.06395348837209303
},
"geometry": {
"type": "Point",
"coordinates": [
118.326443,
35.065282
]
}
},
{
"type": "Feature",
"properties": {
"type": 2,
"ratio": 0.0047,
"lineWidthRatio": 0.06395348837209303
},
"geometry": {
"type": "Point",
"coordinates": [
120.301663,
31.574729
]
}
},
{
"type": "Feature",
"properties": {
"type": 3,
"ratio": 0.0047,
"lineWidthRatio": 0.06395348837209303
},
"geometry": {
"type": "Point",
"coordinates": [
117.283042,
31.86119
]
}
},
{
"type": "Feature",
"properties": {
"type": 4,
"ratio": 0.0046,
"lineWidthRatio": 0.061046511627906974
},
"geometry": {
"type": "Point",
"coordinates": [
119.586579,
39.942531
]
}
},
{
"type": "Feature",
"properties": {
"type": 5,
"ratio": 0.0044,
"lineWidthRatio": 0.05523255813953489
},
"geometry": {
"type": "Point",
"coordinates": [
112.434468,
34.663041
]
}
},
{
"type": "Feature",
"properties": {
"type": 6,
"ratio": 0.0044,
"lineWidthRatio": 0.05523255813953489
},
"geometry": {
"type": "Point",
"coordinates": [
115.980367,
36.456013
]
}
},
{
"type": "Feature",
"properties": {
"type": 7,
"ratio": 0.0044,
"lineWidthRatio": 0.05523255813953489
},
"geometry": {
"type": "Point",
"coordinates": [
126.642464,
45.756967
]
}
},
{
"type": "Feature",
"properties": {
"type": 0,
"ratio": 0.0044,
"lineWidthRatio": 0.05523255813953489
},
"geometry": {
"type": "Point",
"coordinates": [
121.549792,
29.868388
]
}
},
{
"type": "Feature",
"properties": {
"type": 1,
"ratio": 0.0043,
"lineWidthRatio": 0.05232558139534883
},
"geometry": {
"type": "Point",
"coordinates": [
113.883991,
35.302616
]
}
},
{
"type": "Feature",
"properties": {
"type": 2,
"ratio": 0.0043,
"lineWidthRatio": 0.05232558139534883
},
"geometry": {
"type": "Point",
"coordinates": [
113.295259,
40.09031
]
}
},
{
"type": "Feature",
"properties": {
"type": 3,
"ratio": 0.0042,
"lineWidthRatio": 0.04941860465116278
},
"geometry": {
"type": "Point",
"coordinates": [
102.712251,
25.040609
]
}
},
{
"type": "Feature",
"properties": {
"type": 4,
"ratio": 0.0042,
"lineWidthRatio": 0.04941860465116278
},
"geometry": {
"type": "Point",
"coordinates": [
116.587245,
35.415393
]
}
},
{
"type": "Feature",
"properties": {
"type": 5,
"ratio": 0.0041,
"lineWidthRatio": 0.04651162790697675
},
"geometry": {
"type": "Point",
"coordinates": [
114.352482,
36.103442
]
}
},
{
"type": "Feature",
"properties": {
"type": 6,
"ratio": 0.004,
"lineWidthRatio": 0.0436046511627907
},
"geometry": {
"type": "Point",
"coordinates": [
114.075031,
32.123274
]
}
},
{
"type": "Feature",
"properties": {
"type": 7,
"ratio": 0.004,
"lineWidthRatio": 0.0436046511627907
},
"geometry": {
"type": "Point",
"coordinates": [
114.024736,
32.980169
]
}
},
{
"type": "Feature",
"properties": {
"type": 0,
"ratio": 0.004,
"lineWidthRatio": 0.0436046511627907
},
"geometry": {
"type": "Point",
"coordinates": [
114.298572,
30.584355
]
}
},
{
"type": "Feature",
"properties": {
"type": 1,
"ratio": 0.0039,
"lineWidthRatio": 0.04069767441860465
},
"geometry": {
"type": "Point",
"coordinates": [
115.650497,
34.437054
]
}
},
{
"type": "Feature",
"properties": {
"type": 2,
"ratio": 0.0039,
"lineWidthRatio": 0.04069767441860465
},
"geometry": {
"type": "Point",
"coordinates": [
114.940278,
25.85097
]
}
},
{
"type": "Feature",
"properties": {
"type": 3,
"ratio": 0.0038,
"lineWidthRatio": 0.0377906976744186
},
"geometry": {
"type": "Point",
"coordinates": [
125.3245,
43.886841
]
}
},
{
"type": "Feature",
"properties": {
"type": 4,
"ratio": 0.0037,
"lineWidthRatio": 0.034883720930232565
},
"geometry": {
"type": "Point",
"coordinates": [
111.670801,
40.818311
]
}
},
{
"type": "Feature",
"properties": {
"type": 5,
"ratio": 0.0036,
"lineWidthRatio": 0.031976744186046506
},
"geometry": {
"type": "Point",
"coordinates": [
115.819729,
32.896969
]
}
},
{
"type": "Feature",
"properties": {
"type": 6,
"ratio": 0.0035,
"lineWidthRatio": 0.029069767441860465
},
"geometry": {
"type": "Point",
"coordinates": [
111.517973,
36.08415
]
}
},
{
"type": "Feature",
"properties": {
"type": 7,
"ratio": 0.0035,
"lineWidthRatio": 0.029069767441860465
},
"geometry": {
"type": "Point",
"coordinates": [
120.864608,
32.016212
]
}
},
{
"type": "Feature",
"properties": {
"type": 0,
"ratio": 0.0035,
"lineWidthRatio": 0.029069767441860465
},
"geometry": {
"type": "Point",
"coordinates": [
118.956806,
42.275317
]
}
},
{
"type": "Feature",
"properties": {
"type": 1,
"ratio": 0.0035,
"lineWidthRatio": 0.029069767441860465
},
"geometry": {
"type": "Point",
"coordinates": [
112.736465,
37.696495
]
}
},
{
"type": "Feature",
"properties": {
"type": 2,
"ratio": 0.0034,
"lineWidthRatio": 0.026162790697674413
},
"geometry": {
"type": "Point",
"coordinates": [
111.003957,
35.022778
]
}
},
{
"type": "Feature",
"properties": {
"type": 3,
"ratio": 0.0033,
"lineWidthRatio": 0.023255813953488372
},
"geometry": {
"type": "Point",
"coordinates": [
118.016974,
37.383542
]
}
},
{
"type": "Feature",
"properties": {
"type": 4,
"ratio": 0.0033,
"lineWidthRatio": 0.023255813953488372
},
"geometry": {
"type": "Point",
"coordinates": [
121.391382,
37.539297
]
}
},
{
"type": "Feature",
"properties": {
"type": 5,
"ratio": 0.0033,
"lineWidthRatio": 0.023255813953488372
},
"geometry": {
"type": "Point",
"coordinates": [
113.114543,
41.034126
]
}
},
{
"type": "Feature",
"properties": {
"type": 6,
"ratio": 0.0033,
"lineWidthRatio": 0.023255813953488372
},
"geometry": {
"type": "Point",
"coordinates": [
119.649506,
29.089524
]
}
},
{
"type": "Feature",
"properties": {
"type": 7,
"ratio": 0.0033,
"lineWidthRatio": 0.023255813953488372
},
"geometry": {
"type": "Point",
"coordinates": [
106.713478,
26.578343
]
}
},
{
"type": "Feature",
"properties": {
"type": 0,
"ratio": 0.0032,
"lineWidthRatio": 0.020348837209302327
},
"geometry": {
"type": "Point",
"coordinates": [
115.892151,
28.676493
]
}
},
{
"type": "Feature",
"properties": {
"type": 1,
"ratio": 0.0032,
"lineWidthRatio": 0.020348837209302327
},
"geometry": {
"type": "Point",
"coordinates": [
108.705117,
34.333439
]
}
},
{
"type": "Feature",
"properties": {
"type": 2,
"ratio": 0.0032,
"lineWidthRatio": 0.020348837209302327
},
"geometry": {
"type": "Point",
"coordinates": [
114.879365,
30.447711
]
}
},
{
"type": "Feature",
"properties": {
"type": 3,
"ratio": 0.0032,
"lineWidthRatio": 0.020348837209302327
},
"geometry": {
"type": "Point",
"coordinates": [
109.99029,
39.817179
]
}
},
{
"type": "Feature",
"properties": {
"type": 4,
"ratio": 0.0032,
"lineWidthRatio": 0.020348837209302327
},
"geometry": {
"type": "Point",
"coordinates": [
120.672111,
28.000575
]
}
},
{
"type": "Feature",
"properties": {
"type": 5,
"ratio": 0.0031,
"lineWidthRatio": 0.017441860465116275
},
"geometry": {
"type": "Point",
"coordinates": [
108.320004,
22.82402
]
}
},
{
"type": "Feature",
"properties": {
"type": 6,
"ratio": 0.0031,
"lineWidthRatio": 0.017441860465116275
},
"geometry": {
"type": "Point",
"coordinates": [
117.129063,
36.194968
]
}
},
{
"type": "Feature",
"properties": {
"type": 7,
"ratio": 0.0031,
"lineWidthRatio": 0.017441860465116275
},
"geometry": {
"type": "Point",
"coordinates": [
120.139998,
33.377631
]
}
},
{
"type": "Feature",
"properties": {
"type": 0,
"ratio": 0.0031,
"lineWidthRatio": 0.017441860465116275
},
"geometry": {
"type": "Point",
"coordinates": [
120.856394,
40.755572
]
}
},
{
"type": "Feature",
"properties": {
"type": 1,
"ratio": 0.0031,
"lineWidthRatio": 0.017441860465116275
},
"geometry": {
"type": "Point",
"coordinates": [
114.412599,
23.079404
]
}
},
{
"type": "Feature",
"properties": {
"type": 2,
"ratio": 0.0031,
"lineWidthRatio": 0.017441860465116275
},
"geometry": {
"type": "Point",
"coordinates": [
119.946973,
31.772752
]
}
},
{
"type": "Feature",
"properties": {
"type": 3,
"ratio": 0.003,
"lineWidthRatio": 0.014534883720930232
},
"geometry": {
"type": "Point",
"coordinates": [
118.589421,
24.908853
]
}
},
{
"type": "Feature",
"properties": {
"type": 4,
"ratio": 0.003,
"lineWidthRatio": 0.014534883720930232
},
"geometry": {
"type": "Point",
"coordinates": [
113.132855,
29.37029
]
}
},
{
"type": "Feature",
"properties": {
"type": 5,
"ratio": 0.003,
"lineWidthRatio": 0.014534883720930232
},
"geometry": {
"type": "Point",
"coordinates": [
118.047648,
36.814939
]
}
},
{
"type": "Feature",
"properties": {
"type": 6,
"ratio": 0.0029,
"lineWidthRatio": 0.011627906976744179
},
"geometry": {
"type": "Point",
"coordinates": [
119.306239,
26.075302
]
}
},
{
"type": "Feature",
"properties": {
"type": 7,
"ratio": 0.0029,
"lineWidthRatio": 0.011627906976744179
},
"geometry": {
"type": "Point",
"coordinates": [
112.607693,
26.900358
]
}
},
{
"type": "Feature",
"properties": {
"type": 0,
"ratio": 0.0029,
"lineWidthRatio": 0.011627906976744179
},
"geometry": {
"type": "Point",
"coordinates": [
115.041299,
35.768234
]
}
},
{
"type": "Feature",
"properties": {
"type": 1,
"ratio": 0.0029,
"lineWidthRatio": 0.011627906976744179
},
"geometry": {
"type": "Point",
"coordinates": [
109.502882,
34.499381
]
}
},
{
"type": "Feature",
"properties": {
"type": 2,
"ratio": 0.0029,
"lineWidthRatio": 0.011627906976744179
},
"geometry": {
"type": "Point",
"coordinates": [
115.992811,
29.712034
]
}
},
{
"type": "Feature",
"properties": {
"type": 3,
"ratio": 0.0029,
"lineWidthRatio": 0.011627906976744179
},
"geometry": {
"type": "Point",
"coordinates": [
111.134335,
37.524366
]
}
},
{
"type": "Feature",
"properties": {
"type": 4,
"ratio": 0.0028,
"lineWidthRatio": 0.008720930232558138
},
"geometry": {
"type": "Point",
"coordinates": [
114.341447,
34.797049
]
}
},
{
"type": "Feature",
"properties": {
"type": 5,
"ratio": 0.0028,
"lineWidthRatio": 0.008720930232558138
},
"geometry": {
"type": "Point",
"coordinates": [
121.618622,
38.91459
]
}
},
{
"type": "Feature",
"properties": {
"type": 6,
"ratio": 0.0028,
"lineWidthRatio": 0.008720930232558138
},
"geometry": {
"type": "Point",
"coordinates": [
113.826063,
34.022956
]
}
},
{
"type": "Feature",
"properties": {
"type": 7,
"ratio": 0.0028,
"lineWidthRatio": 0.008720930232558138
},
"geometry": {
"type": "Point",
"coordinates": [
106.937265,
27.706626
]
}
},
{
"type": "Feature",
"properties": {
"type": 0,
"ratio": 0.0028,
"lineWidthRatio": 0.008720930232558138
},
"geometry": {
"type": "Point",
"coordinates": [
87.617733,
43.792818
]
}
},
{
"type": "Feature",
"properties": {
"type": 1,
"ratio": 0.0028,
"lineWidthRatio": 0.008720930232558138
},
"geometry": {
"type": "Point",
"coordinates": [
120.750865,
30.762653
]
}
},
{
"type": "Feature",
"properties": {
"type": 2,
"ratio": 0.0028,
"lineWidthRatio": 0.008720930232558138
},
"geometry": {
"type": "Point",
"coordinates": [
113.307718,
33.735241
]
}
},
{
"type": "Feature",
"properties": {
"type": 3,
"ratio": 0.0027,
"lineWidthRatio": 0.0058139534883720955
},
"geometry": {
"type": "Point",
"coordinates": [
103.823557,
36.058039
]
}
},
{
"type": "Feature",
"properties": {
"type": 4,
"ratio": 0.0027,
"lineWidthRatio": 0.0058139534883720955
},
"geometry": {
"type": "Point",
"coordinates": [
109.741193,
38.290162
]
}
},
{
"type": "Feature",
"properties": {
"type": 5,
"ratio": 0.0027,
"lineWidthRatio": 0.0058139534883720955
},
"geometry": {
"type": "Point",
"coordinates": [
112.23813,
30.326857
]
}
},
{
"type": "Feature",
"properties": {
"type": 6,
"ratio": 0.0026,
"lineWidthRatio": 0.0029069767441860417
},
"geometry": {
"type": "Point",
"coordinates": [
113.382391,
22.521113
]
}
},
{
"type": "Feature",
"properties": {
"type": 7,
"ratio": 0.0025,
"lineWidthRatio": 0
},
"geometry": {
"type": "Point",
"coordinates": [
112.144146,
32.042426
]
}
},
{
"type": "Feature",
"properties": {
"type": 0,
"ratio": 0.0025,
"lineWidthRatio": 0
},
"geometry": {
"type": "Point",
"coordinates": [
113.113556,
36.191112
]
}
},
{
"type": "Feature",
"properties": {
"type": 1,
"ratio": 0.0025,
"lineWidthRatio": 0
},
"geometry": {
"type": "Point",
"coordinates": [
114.391136,
27.8043
]
}
},
{
"type": "Feature",
"properties": {
"type": 2,
"ratio": 0.0025,
"lineWidthRatio": 0
},
"geometry": {
"type": "Point",
"coordinates": [
111.691347,
29.040225
]
}
}
]
}