fix: conflict

This commit is contained in:
ParryQiu 2020-02-01 19:24:07 +08:00
parent be6b65ac83
commit ad3f1c08dd
1 changed files with 43 additions and 0 deletions

View File

@ -0,0 +1,43 @@
import {
Scene,
Marker,
MarkerLayer
} from '@antv/l7';
import {
GaodeMap
} from '@antv/l7-maps';
const scene = new Scene({
id: 'map',
map: new GaodeMap({
style: 'light',
center: [ 105.790327, 36.495636 ],
pitch: 0,
zoom: 4
})
});
addMarkers();
scene.render();
function addMarkers() {
fetch(
'https://gw.alipayobjects.com/os/basement_prod/d3564b06-670f-46ea-8edb-842f7010a7c6.json'
)
.then(res => res.json())
.then(nodes => {
const markerLayer = new MarkerLayer({
cluster: true
});
for (let i = 0; i < nodes.features.length; i++) {
const {
coordinates
} = nodes.features[i].geometry;
const marker = new Marker().setLnglat({
lng: coordinates[0],
lat: coordinates[1]
});
markerLayer.addMarker(marker);
}
scene.addMarkerLayer(markerLayer);
});
}