This blog post provides a solution for:
Capturing multiple locations per survey
Calculating straight-line distances between a base location point in the survey and other repeating locations captured
Consider the scenario where your survey must assist in the administration of new liquor licence applications and the law stipulates: New liquor premises must be located at least five hundred meters (500m) away from schools, places of worship, recreation facilities, rehabilitation or retreat centers, residential areas and public institutions.
For this requirement Survey123 can be a valuable tool and in this blog post I will show you how you can enable this functionality in a Survey123 form:
Step 1: Create a new survey with Survey123 Connect
Step 2: Create a geopoint field in the main survey which will be used to capture the location of the new licence premises (the base point or new_licence_location field in the survey below)
Step 3: Create a repeat section to capture the occurrences of nearby schools, places of worship etc. Each with a premise type and a geopoint (the nearby_location field in the survey below)
Your survey design should look similar to this:
Step 4: Now, split both the coordinates sets into their x,y pairs and convert them to radians:
Do the same for the nearby_location geopoint field:
Step 5: Use the X, Y (lat,long) pairs to perform the distance calculation (in meters) with the Haversine formula:
After making some cosmetic enhancements (and adding the 500m stipulation) your survey should look like this:
The user can add multiple locations (Nearby Premises) at will in the repeat section and each will have it's own distance calculation to the base point (New Licence Location).