2019-11-21 17:52:18 +08:00
|
|
|
import { Scene, PointLayer } from '@antv/l7';
|
2019-11-27 14:54:53 +08:00
|
|
|
import { GaodeMap } from '@antv/l7-maps';
|
2019-11-26 17:51:29 +08:00
|
|
|
|
2019-11-16 22:22:13 +08:00
|
|
|
const scene = new Scene({
|
|
|
|
id: 'map',
|
2019-11-27 14:54:53 +08:00
|
|
|
map: new GaodeMap({
|
2019-11-26 17:51:29 +08:00
|
|
|
pitch: 0,
|
|
|
|
style: 'light',
|
|
|
|
center: [ 116.276227, 35.256776 ],
|
|
|
|
zoom: 6
|
2019-11-26 19:17:39 +08:00
|
|
|
})
|
2019-11-16 22:22:13 +08:00
|
|
|
});
|
|
|
|
|
2019-11-20 17:26:24 +08:00
|
|
|
fetch(
|
|
|
|
'https://gw.alipayobjects.com/os/basement_prod/e2fc6e0a-af2a-4320-96e5-d9f5a5fda442.json'
|
|
|
|
)
|
|
|
|
.then(res => res.json())
|
|
|
|
.then(data => {
|
2019-11-19 10:21:43 +08:00
|
|
|
scene.addImage(
|
|
|
|
'marker',
|
2019-11-20 17:26:24 +08:00
|
|
|
'https://gw.alipayobjects.com/mdn/antv_site/afts/img/A*BJ6cTpDcuLcAAAAAAAAAAABkARQnAQ'
|
2019-11-19 10:21:43 +08:00
|
|
|
);
|
|
|
|
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);
|
2019-11-19 10:21:43 +08:00
|
|
|
scene.addLayer(imageLayer);
|
2019-11-16 22:22:13 +08:00
|
|
|
});
|