Select to view content in your preferred language

Choosing between overlapping polygons when editing data with a feature form using the JavaScript API 4.11

1629
5
Jump to solution
06-07-2019 06:45 AM
GregMcNamee
Regular Contributor

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?

Greg McNamee
0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

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.

View solution in original post

0 Kudos
5 Replies
RobertScheitlin__GISP
MVP Emeritus

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.

0 Kudos
GregMcNamee
Regular Contributor

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 McNamee
0 Kudos
RobertScheitlin__GISP
MVP Emeritus

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.

0 Kudos
GregMcNamee
Regular Contributor

Yeah. misspoke.

view.on("click", function(event) {
   polyLayer.queryFeatures({
      geometry: event.mapPoint,

...

Greg McNamee
0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Yep that is it. Don't Forget to mark this question as answered.

0 Kudos