antv-l7/examples/line/path/demo/road_light.js

28 lines
648 B
JavaScript
Raw Normal View History

2019-11-21 17:52:18 +08:00
import { Scene, LineLayer } from '@antv/l7';
import { Mapbox } from '@antv/l7-maps';
2019-11-14 11:50:12 +08:00
const scene = new Scene({
id: 'map',
map: new Mapbox({
center: [ 116.3956, 39.9392 ],
pitch: 0,
zoom: 10,
rotation: 0,
2019-11-26 19:17:39 +08:00
style: 'light'
})
2019-11-14 11:50:12 +08:00
});
2020-03-15 20:09:16 +08:00
scene.on('loaded', () => {
fetch(
'https://gw.alipayobjects.com/os/basement_prod/0d2f0113-f48b-4db9-8adc-a3937243d5a3.json'
)
.then(res => res.json())
.then(data => {
const layer = new LineLayer({})
.source(data)
.size(1.5)
.shape('line')
.color('标准名称', [ '#5B8FF9', '#5CCEA1', '#5D7092' ]);
scene.addLayer(layer);
});
});