Skip to content
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

Open
tang1130 opened this issue Aug 22, 2024 · 3 comments
Open

markerlayer在聚合后,这些marker的extData丢失了 #2597

tang1130 opened this issue Aug 22, 2024 · 3 comments
Assignees

Comments

@tang1130
Copy link

问题描述

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

平台

  • 操作系统: [macOS, Windows, Linux, React Native ...]
  • 网页浏览器: [Google Chrome, Safari, Firefox]

屏幕截图或视频(可选)

No response

补充说明(可选)

No response

Copy link
Contributor

Hi @tang1130, Please star this repo if you find it useful! Thanks ⭐!
你好~ @tang1130 🌟 如果这个仓库对你有帮助,可以给我们点个star支持一下~你的支持对我们来说是最大的鼓励,感谢你的支持与点赞 🌟

@tang1130
Copy link
Author

1

@lvisei
Copy link
Member

lvisei commented Aug 23, 2024

@heiyexing 看一下这个~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants