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

31 lines
645 B
JavaScript
Raw Normal View History

2019-11-18 16:13:15 +08:00
import { Scene } from '@l7/scene';
2019-11-20 17:26:24 +08:00
import { PointLayer } from '@l7/layers';
2019-11-18 16:13:15 +08:00
const scene = new Scene({
id: 'map',
type: 'amap',
style: 'dark',
2019-11-20 17:26:24 +08:00
center: [ 121.417463, 31.215175 ],
2019-11-18 16:13:15 +08:00
pitch: 0,
zoom: 11
});
window.mapScene = scene;
fetch('https://gw.alipayobjects.com/os/rmsportal/BElVQFEFvpAKzddxFZxJ.txt')
2019-11-20 17:26:24 +08:00
.then(res => res.text())
.then(data => {
const pointLayer = new PointLayer({})
2019-11-18 16:13:15 +08:00
.source(data, {
parser: {
type: 'csv',
y: 'lat',
x: 'lng'
}
2019-11-20 17:26:24 +08:00
})
.size(0.5)
2019-11-18 16:13:15 +08:00
.color('#080298')
.style({
2019-11-20 17:26:24 +08:00
opacity: 1
});
2019-11-18 16:13:15 +08:00
2019-11-20 17:26:24 +08:00
scene.addLayer(pointLayer);
});