I am currently looking to introduce spatial checks on a public survey. My desired outcome is for the system to prevent the end user for placing a point outside an existing polygon. Knowing the limitations around custom JS functions, I was wondering if there are any ideas on how best to approach this?
You could probably get this to work with a simple extent, but I don't know that it's possible to do this with a full-blown polygon.
Where's the data come from? Do you have access to Attribute Rules for this layer? A constraint rule would be perfect for this.
Thank you for your reply.
We have 2 data sources:
1: User input geopoint
2: Hosted feature layer in our AGOL (polygon) which we have complete control over.
Essentially I want to ensure that the end user places the geopoint within the polygon and not outside.
Does this make sense?
It makes sense, I just don't think it's possible in a public survey. As I was referring to, you could pull the lat/lon from the place point and use defined min/max values to at least constrain points to the rectangular extent of the polygon.
Beyond that, I think all you can do is put a warning in large text informing users that if they don't place points within the polygon, their input will be thrown out. Then create a view of the hosted layer with a spatial filter on it corresponding to the polygon.
Also! Make sure that the polygon boundary is visible in the survey map!