Validate GPS location against pre-defined Polygon location


This sample demonstrates a way to validate the surveyor's Location against a predefined location of the selected city.

The general logic is this:

- The surveyor chooses a Location from the displayed PSU list.

- If the survey is conducted on an Android device, then question Q_2 will be displayed to the respondent, and the current Location will be auto-captured by the device.

- If the survey is not conducted on an Android device, then question Q_3 will be displayed to the respondent, and the respondent will have to fill the current Location manually.

- The logic is placed in the Start Script Q_4. Once there is a valid GPS location, the code compares the captured Location and the predefined Location of the selected PSU, and checks if the "current location" is inside the PSU or not, and will display the needed message to the surveyor.


For your reference, the Polygon locations on a Map(each Location represented by the Location_Name), we added a few types of polygons(triangle, square, etc.)



To import the attached SRV file, follow this link: How To Import a Survey


The predefined PSUs can be found in the attached excel file. This file needs to be imported to the studio as an additional data list and be attached to the survey. Please follow this link to learn more about additional data lists and subject stores: How to use an excel file as a data list in a survey 

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request



Please sign in to leave a comment.