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

49 lines
959 B
JavaScript
Raw Normal View History

2019-11-21 17:52:18 +08:00
import { Scene, PointLayer } from '@antv/l7';
import { GaodeMap } from '@antv/l7-maps';
2019-11-14 11:50:12 +08:00
const scene = new Scene({
id: 'map',
map: new GaodeMap({
style: 'light',
center: [ -121.24357, 37.58264 ],
pitch: 0,
zoom: 6.45
2019-11-26 19:17:39 +08:00
})
2019-11-14 11:50:12 +08:00
});
2019-11-20 17:26:24 +08:00
fetch(
'https://gw.alipayobjects.com/os/basement_prod/6c4bb5f2-850b-419d-afc4-e46032fc9f94.csv'
2019-11-20 17:26:24 +08:00
)
.then(res => res.text())
2019-11-20 17:26:24 +08:00
.then(data => {
const pointLayer = new PointLayer({})
.source(data, {
parser: {
type: 'csv',
x: 'Longitude',
y: 'Latitude'
}
})
.shape('circle')
.size(4)
2020-01-07 21:15:23 +08:00
.active(true)
.color('Magnitude', [
2019-11-20 17:26:24 +08:00
'#0A3663',
'#1558AC',
'#3771D9',
'#4D89E5',
'#64A5D3',
'#72BED6',
'#83CED6',
'#A6E1E0',
'#B8EFE2',
'#D7F9F0'
])
.style({
opacity: 0.5,
strokeWidth: 0
2019-11-20 17:26:24 +08:00
});
2019-11-14 11:50:12 +08:00
2019-11-20 17:26:24 +08:00
scene.addLayer(pointLayer);
});