Select to view content in your preferred language

FeatureLayerView queryFeatures doesn't return features for aggregates

225
1
04-08-2024 10:28 AM
saqibqureshi
New Contributor

Following code snippets works perfectly until data in the layer is refreshed again after initial load. Once data is reloaded the following code doesn't list features from the layerview for a cluster.

Once map is zoomed In/Out, the query starts working again. I think the layerView needs refresh, but there is nothing I could find to do that. 

 

 

const { results } = await view.hitTest(evt, { include: featureLayer });
if (results[0].graphic.isAggregate) {
    const layerView = await view.whenLayerView(featureLayer);
    const query = layerView.createQuery();
    query.aggregateIds = [results[0].graphic.getObjectId()];
    const { features } = await layerView.queryFeatures(query);
    console.log(features.length + " features found");
}

 

 

 

0 Kudos
1 Reply
UndralBatsukh
Esri Regular Contributor

Hi there, 

I am not able to reproduce the behavior you are referring to. Can you please provide a simple codepen that shows the behavior in question? Which version of the API are you using?

0 Kudos