我目前正在使用 esri 4.15 的 geoJSONLayer featureReduction 类型“集群”。当我单击聚集点打开 popupTemplate 时,如何获取子图形及其属性。在 esri 3.32 中,我可以通过在 FeatureLayer 中注册点击事件来使用 event.graphic.getChildGraphics()。我现在看不到这个选项。
geoJsonLayer = new GeoJSONLayer({
url: "https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_month.geojson",
copyright: "USGS Earthquakes",
outFields: ['mag', 'place'],
popupTemplate: {content: mapPopupFunction},
featureReduction: {
type: "cluster", clusterRadius: "100px",
popupTemplate: {content: mapPopupFunction}
},
renderer: {
type: "simple", field: "mag",
symbol: { type: "simple-marker", size: 4, color: "#1D1D1D", outline: { color: "#F4BA05" }}
}
});
function mapPopupFunction(feature) {
console.log(feature.graphic.attributes);
//I get this if I click on a single point - non clustered point is good
// {OBJECTID: 7351, mag: 4.1, place: "219km WSW of Severo-Kuril'sk, Russia"}
// but for the clustered point I get the below. I need the child graphics and it's attribute.
// {cluster_count: 1896, clusterId: 536887302}
// I have the OBJECT ID feature.graphic.getObjectId() but I how do I get child graphics associated to it
}