Esri Map 4.15 getChildGraphics для geoJSONLayer - применен "кластер" FeatureReduction - PullRequest
1 голос
/ 28 мая 2020

В настоящее время я использую geoJSONLayer featureReduction type 'cluster' с esri 4.15. Когда я нажимаю кластерную точку, чтобы открыть popupTemplate, я узнаю, как получить дочернюю графику и ее атрибут. В esri 3.32 я мог использовать event.graphi c .getChildGraphics (), зарегистрировав событие щелчка в FeatureLayer. Сейчас я не вижу этой опции.

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
}
...