antv-l7/examples/point/bubble/demo/point.js

35 lines
732 B
JavaScript
Raw Normal View History

2019-11-21 17:52:18 +08:00
import { Scene, PointLayer } from '@antv/l7';
import { AMap } from '@antv/l7-maps';
2019-11-06 11:57:42 +08:00
const scene = new Scene({
id: 'map',
map: new AMap({
pitch: 0,
type: 'amap',
style: 'light',
center: [ 140.067171, 36.26186 ],
zoom: 5.32,
2019-11-26 19:17:39 +08:00
maxZoom: 10
})
2019-11-06 11:57:42 +08:00
});
2019-11-17 17:31:01 +08:00
2019-11-20 17:26:24 +08:00
fetch(
'https://gw.alipayobjects.com/os/basement_prod/d3564b06-670f-46ea-8edb-842f7010a7c6.json'
)
.then(res => res.json())
.then(data => {
const pointLayer = new PointLayer({})
.source(data)
.shape('circle')
.size('mag', [ 1, 25 ])
.color('mag', mag => {
return mag > 4.5 ? '#5B8FF9' : '#5CCEA1';
})
.style({
opacity: 0.3,
strokeWidth: 1
});
2019-11-17 17:31:01 +08:00
2019-11-20 17:26:24 +08:00
scene.addLayer(pointLayer);
2019-11-17 17:31:01 +08:00
});