antv-l7/examples/gallery/basic/demo/point.js

37 lines
738 B
JavaScript
Raw Normal View History

2019-11-21 17:52:18 +08:00
import { Scene, PointLayer } from '@antv/l7';
2019-11-18 16:13:15 +08:00
const scene = new Scene({
id: 'map',
pitch: 64.88,
type: 'amap',
style: 'dark',
2019-11-20 17:26:24 +08:00
center: [ 114.060288, 22.53684 ],
zoom: 15.63
2019-11-18 16:13:15 +08:00
});
window.mapScene = scene;
2019-11-20 17:26:24 +08:00
fetch(
'https://gw.alipayobjects.com/os/basement_prod/513add53-dcb2-4295-8860-9e7aa5236699.json'
)
.then(res => res.json())
.then(data => {
const pointLayer = new PointLayer({})
.source(data)
.size(2)
.color('h8', [
'#0A3663',
'#1558AC',
'#3771D9',
'#4D89E5',
'#64A5D3',
'#72BED6',
'#83CED6',
'#A6E1E0',
'#B8EFE2',
'#D7F9F0'
])
.style({
opacity: 1
});
2019-11-18 16:13:15 +08:00
2019-11-20 17:26:24 +08:00
scene.addLayer(pointLayer);
});