I've created an app that uses a featureForm to edit data using the JavaScript API (4.11). The data represents project areas for the next 5 years, and there are cases where the polygons don't change from year to year. My question is how do I deal with identical polygons? The script uses a hitTest to query features and populate the featureForm. But this only selects the topmost polygon. How do I give the user the option to toggle between polygons.
My initial thought was to use the popup and a popup action. I successfully created a popup action which allows the user to choose which polygon they want, but there some issues when the featureForm populates. Sometimes the data in the form is incorrect. Is using a popup action the best way to go about this? Or is there a better option?
Solved! Go to Solution.
Greg the recommended approach to this is to use a query and the click point to query the layer and return all the intersecting features instead of the hittest.
Greg the recommended approach to this is to use a query and the click point to query the layer and return all the intersecting features instead of the hittest.
Yeah I thought about this. So query features based on the mapPoint returned by the hittest and then build some mechanism for users to toggle between the returned query values? That makes sense - I was hoping there was an easier way.
Greg,
No the hit itest is no longer involved no you just query on the view click event. Sorry there is no easier way currently.
Yeah. misspoke.
view.on("click", function(event) {
polyLayer.queryFeatures({
geometry: event.mapPoint,
...
Yep that is it. Don't Forget to mark this question as answered.