Point in Polygon Queries for Data Validation

641
3
09-20-2023 09:07 AM
AmandaBeck
Occasional Contributor

Hi everyone, 

I'm having some trouble in S123 Connect with having submitters place a point on a map - to check if the point falls within a certain polygon. From all the research I have done to try and implement this, I can't find a good example of what I am trying to do. Below is a screenshot from a "Survey123 Tricks of the Trade" post showing what I want to recreate, however, it does not show what I'm actually supposed to do in Connect  to make this work.

I know how to use the pull data function to query other question answers, but I'm not sure how to do this for data validation on a geopoint question.

Basically, I have a geopoint question with a buffer on a basemap - any points that are made outside the buffer a note will pop up stating that they are within or outside the buffered zone.

Any help would be greatly appreciated! Thanks! 

 pointinpolygon.jpg

0 Kudos
3 Replies
IsmaelChivite
Esri Notable Contributor

In the Tricks of the Trade blog you looked at, there are a handful of XLSForms at the bottom (right before the comments section). Download the GetValueAt_Constraint XLSForm

 

IsmaelChivite_0-1695226549922.png

 

0 Kudos
AmandaBeck
Occasional Contributor

Hi @IsmaelChivite 

Thank you for your quick reply. I have looked at that example, but didn't think it was what I was looking for. The polygon in which I have in my basemap in Survey123 connect does not a have a field in which I want to pull data from. I'll explain further below. 

In that example, if I'm understanding it correctly, it is depicting making a point - but that point HAS to be in Spain which has been pulled from a layer that has a Countries field in it with Spain in the attributes. 

In my case, since I am making a point and wanting to check simply if that location chosen is within a buffer of a lake - do I need to have a specific field in the buffer layer from which I can pull the data from? 

For example, I could make a 250foot field in my polygon layer and have the attributes be yes/no. In the text question type, I would pull data from that field and set the constraint on the geopoint to be ${250foot}="yes" and the constraint message to The location is not within 250 feet of the lake. 

Please let me know your thoughts. 

Thanks in advance! 

0 Kudos
JamesTedrick
Esri Esteemed Contributor

Hi @AmandaBeck ,

The easiest way to check to see if the result is by a feature is to request any field that is filled in for each record (say objectId, or perhaps the name) and then checking to make sure the value is not null.  If the result is null, that means that no features were found.

A more complicated method that specifically gets the number of features that match the query is to use  the outStatistics capability to get the count of records that meet the query.  These would be placed in the same part of the setup as the distance properties. That would look like:

pulldata("@layer", "getValueAt", "attributes.count_features", '<SERVICE>?distance=250&units=esriSRUnit_Foot&outStatistics=[{"statisticType": "count","onStatisticField": "objectid","outStatisticFieldName": "count_features"}]', ${location})