Ashutosh Sharma
Ashutosh Sharma

Reputation: 31

Esri Map 4.15 getChildGraphics for geoJSONLayer - FeatureReduction "cluster" applied

I am currently using geoJSONLayer featureReduction type 'cluster' with esri 4.15. When I click on the clustered point to open popupTemplate, how to I get the child graphics and it's attribute. In esri 3.32 I could use event.graphic.getChildGraphics() by registering click event in FeatureLayer. I don't see this option now.

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
}

Upvotes: 3

Views: 104

Answers (0)

Related Questions