2019-11-21 17:52:18 +08:00
|
|
|
import { Scene, LineLayer } from '@antv/l7';
|
2019-11-26 17:51:29 +08:00
|
|
|
import { Mapbox } from '@antv/l7-maps';
|
|
|
|
|
2019-11-17 17:31:01 +08:00
|
|
|
const scene = new Scene({
|
|
|
|
id: 'map',
|
2019-11-26 17:51:29 +08:00
|
|
|
map: new Mapbox({
|
|
|
|
pitch: 60,
|
|
|
|
style: 'dark',
|
|
|
|
center: [ 104.34278, 41.12554 ],
|
|
|
|
zoom: 2.94888,
|
2019-11-26 19:17:39 +08:00
|
|
|
rotation: 42.3999
|
|
|
|
})
|
2019-11-17 17:31:01 +08:00
|
|
|
});
|
2020-03-15 20:09:16 +08:00
|
|
|
scene.on('loaded', () => {
|
2022-01-10 10:02:35 +08:00
|
|
|
fetch('https://gw.alipayobjects.com/os/bmw-prod/e495c407-953b-44cc-8f77-87b9cf257578.json')
|
|
|
|
.then(res => res.json())
|
2020-03-15 20:09:16 +08:00
|
|
|
.then(data => {
|
|
|
|
const layer = new LineLayer({})
|
|
|
|
.source(data, {
|
|
|
|
parser: {
|
2022-01-17 20:39:01 +08:00
|
|
|
type: 'json',
|
2022-01-10 10:02:35 +08:00
|
|
|
x: 'from_lon',
|
|
|
|
y: 'from_lat',
|
|
|
|
x1: 'to_lon',
|
|
|
|
y1: 'to_lat'
|
2020-03-15 20:09:16 +08:00
|
|
|
}
|
|
|
|
})
|
|
|
|
.size(1)
|
2022-01-17 20:39:01 +08:00
|
|
|
.shape('arc3d')
|
2020-03-15 20:09:16 +08:00
|
|
|
.color('#FF7C6A')
|
|
|
|
.style({
|
2022-01-10 10:02:35 +08:00
|
|
|
segmentNumber: 15,
|
2020-03-15 20:09:16 +08:00
|
|
|
opacity: 0.8
|
|
|
|
});
|
|
|
|
scene.addLayer(layer);
|
|
|
|
});
|
|
|
|
});
|