2019-11-21 17:52:18 +08:00
|
|
|
import { Scene, PolygonLayer, LineLayer } from '@antv/l7';
|
2019-11-27 14:54:53 +08:00
|
|
|
import { GaodeMap } from '@antv/l7-maps';
|
2019-11-26 17:51:29 +08:00
|
|
|
|
2019-11-07 00:52:03 +08:00
|
|
|
const scene = new Scene({
|
|
|
|
id: 'map',
|
2019-11-27 14:54:53 +08:00
|
|
|
map: new GaodeMap({
|
2019-11-26 17:51:29 +08:00
|
|
|
pitch: 0,
|
|
|
|
style: 'light',
|
|
|
|
center: [ 107.042225, 37.66565 ],
|
|
|
|
zoom: 3.87
|
2019-11-26 19:17:39 +08:00
|
|
|
})
|
2019-11-07 00:52:03 +08:00
|
|
|
});
|
|
|
|
|
2019-11-10 21:20:26 +08:00
|
|
|
fetch('https://gw.alipayobjects.com/os/rmsportal/JToMOWvicvJOISZFCkEI.json')
|
2019-11-20 17:26:24 +08:00
|
|
|
.then(res => res.json())
|
|
|
|
.then(data => {
|
|
|
|
const colors = [
|
|
|
|
'#D7F9F0',
|
|
|
|
'#A6E1E0',
|
|
|
|
'#72BED6',
|
|
|
|
'#5B8FF9',
|
|
|
|
'#3474DB',
|
|
|
|
'#005CBE',
|
|
|
|
'#00419F',
|
|
|
|
'#00287E'
|
|
|
|
];
|
|
|
|
const layer = new PolygonLayer({})
|
2019-11-07 00:52:03 +08:00
|
|
|
.source(data)
|
2019-11-20 17:26:24 +08:00
|
|
|
.color('name', colors)
|
|
|
|
.shape('fill')
|
2019-11-07 00:52:03 +08:00
|
|
|
.style({
|
2019-11-10 21:20:26 +08:00
|
|
|
opacity: 0.9
|
2019-11-16 22:22:13 +08:00
|
|
|
});
|
|
|
|
|
2019-11-20 17:26:24 +08:00
|
|
|
const layer2 = new LineLayer({
|
|
|
|
zIndex: 2
|
|
|
|
})
|
2019-11-16 22:22:13 +08:00
|
|
|
.source(data)
|
2019-11-20 17:26:24 +08:00
|
|
|
.color('#fff')
|
|
|
|
.size(0.3)
|
|
|
|
.style({
|
2019-11-16 22:22:13 +08:00
|
|
|
opacity: 1
|
2019-11-20 17:26:24 +08:00
|
|
|
});
|
|
|
|
|
2019-11-07 00:52:03 +08:00
|
|
|
scene.addLayer(layer);
|
2019-11-16 22:22:13 +08:00
|
|
|
scene.addLayer(layer2);
|
2019-11-07 00:52:03 +08:00
|
|
|
});
|