-
Notifications
You must be signed in to change notification settings - Fork 634
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
markerlayer在聚合后,这些marker的extData丢失了 #2597
Comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
问题描述
markerlayer在聚合后,先获取全部markers,然后获取这些marker的extData,发现数据丢失了
重现链接
No response
重现步骤
import { Marker, MarkerLayer, Scene } from '@antv/l7';
import { GaodeMap } from '@antv/l7-maps';
const scene = new Scene({
id: 'map',
map: new GaodeMap({
style: 'light',
center: [105.790327, 30],
zoom: 2,
}),
});
scene.on('loaded', () => {
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({extData:{'name':'test'}}).setLnglat({
lng: coordinates[0],
lat: coordinates[1],
});
markerLayer.addMarker(marker);
}
scene.addMarkerLayer(markerLayer);
const maps = markerLayer.getMarkers().map(item=>item.getExtData());
console.log(maps) ; // 此处打印 [undefined,undefined,undefined,...]
});
}
预期行为
我期望得到marker的原始数据,但我得到的是undefined
平台
屏幕截图或视频(可选)
No response
补充说明(可选)
No response
The text was updated successfully, but these errors were encountered: