antvis / L7

🌎 Large-scale WebGL-powered Geospatial Data Visualization analysis engine.
https://l7.antv.antgroup.com
MIT License
3.67k stars 636 forks source link

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

Open tang1130 opened 3 months ago

tang1130 commented 3 months ago

问题描述

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

github-actions[bot] commented 3 months ago

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

tang1130 commented 3 months ago

1

lvisei commented 3 months ago

@heiyexing 看一下这个~