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

43 lines
1.0 KiB
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';
const scene = new Scene({
id: 'map',
map: new AMap({
pitch: 0,
style: 'light',
center: [ 121.434765, 31.256735 ],
zoom: 14.83
2019-11-26 19:17:39 +08:00
})
});
2019-11-20 17:26:24 +08:00
fetch(
'https://gw.alipayobjects.com/os/basement_prod/893d1d5f-11d9-45f3-8322-ee9140d288ae.json'
)
.then(res => res.json())
.then(data => {
scene.addImage(
'00',
2019-11-20 17:26:24 +08:00
'https://gw.alipayobjects.com/zos/basement_prod/604b5e7f-309e-40db-b95b-4fac746c5153.svg'
);
scene.addImage(
'01',
2019-11-20 17:26:24 +08:00
'https://gw.alipayobjects.com/zos/basement_prod/30580bc9-506f-4438-8c1a-744e082054ec.svg'
);
scene.addImage(
'02',
2019-11-20 17:26:24 +08:00
'https://gw.alipayobjects.com/zos/basement_prod/7aa1f460-9f9f-499f-afdf-13424aa26bbf.svg'
);
const imageLayer = new PointLayer()
.source(data, {
parser: {
type: 'json',
x: 'longitude',
y: 'latitude'
}
})
2019-11-20 17:26:24 +08:00
.shape('name', [ '00', '01', '02' ])
2019-11-10 21:20:26 +08:00
.size(20);
scene.addLayer(imageLayer);
});