antv-l7/examples/point/image/demo/locate.js

29 lines
636 B
JavaScript
Raw Normal View History

2019-11-16 22:22:13 +08:00
import { Scene } from '@l7/scene';
import { PointLayer } from '@l7/layers'
2019-11-16 22:22:13 +08:00
const scene = new Scene({
id: 'map',
pitch: 0,
type: 'amap',
style: 'light',
center: [116.276227, 35.256776],
zoom: 6,
});
fetch('https://gw.alipayobjects.com/os/basement_prod/e2fc6e0a-af2a-4320-96e5-d9f5a5fda442.json')
.then((res) => res.json())
.then((data) => {
scene.addImage(
'marker',
'https://gw.alipayobjects.com/mdn/antv_site/afts/img/A*BJ6cTpDcuLcAAAAAAAAAAABkARQnAQ',
);
const imageLayer = new PointLayer()
.source(data)
2019-11-16 22:22:13 +08:00
.shape('marker')
2019-11-18 16:13:15 +08:00
.size(12);
scene.addLayer(imageLayer);
2019-11-18 16:13:15 +08:00
2019-11-16 22:22:13 +08:00
});