Hello,
I'm struggling to implement a pop-up in my app which shows the features of a webmap which have been filtered in a spatial query via a geometry (i.e. point, line, polgon.)
I wanted to ask whether it is possible to implement a pop-up in this way, or whether I would have to keep things simple and select only a point within a geometry, such as the centroid in this example? https://developers.arcgis.com/javascript/latest/sample-code/featurelayerview-query/
view.openPopup({
features: [result],
location: result.geometry.centroid
});
I know that in examples like this, you can produce a pop-up via a click:
https://developers.arcgis.com/javascript/latest/sample-code/sandbox/?sample=widgets-feature-multiplelayers
The way my app works is that a sketch geometry, 'filterGeometry' is generated and then used alongside a spatial relationship (e.g. 'intersect') to filter a view of all the layers in the webmap, called 'featureLayerView.' This results in 'featureFilter.'
// set the geometry filter on the visible FeatureLayerView
function updateFilter() {
updateFilterGeometry();
const featureFilter = {
// autocasts to FeatureFilter
geometry: filterGeometry,
spatialRelationship: selectedFilter
};
featureLayerView.forEach((featureLayerView) => {
if (featureLayerViewFilterSelected) { //If true
featureLayerView.visible = true; //Set the layers to visible
featureLayerView.filter = featureFilter; //filter the features
} else {
featureLayerView.filter = null;//else nothing
}
});
};
Would it be possible to enable a pop-up to automatically show after the sketch geometry has been drawn and the features have been filtered? (i.e. after the UpdateFilters() function has run.)
I'm still very new to app development, so any help would be greatly appreciated.
Many thanks.