Multiple Geopoints to calculate curve distance

08-04-2021 02:10 PM
New Contributor II

I've created a form that uses the following formula to calculate the straight line distance between geopoints. This worked great, but new requirements has meant that calculating distance around a curve is required and the straightline distance will be outside the acceptable error in some cases.

if(number(${upchain_curve_location_lat})!=0,int(acos(sin(${upchain_curve_location_lat})*sin(${access_lat}) + cos(${upchain_curve_location_lat})*cos(${access_lat})*cos(${access_long}-${upchain_curve_location_long}) ) * 6371000),0)

The use case is a maximum of 4 geopoints within a repeat in addition to the main geopoint, one per type of feature since we're only collecting the nearest of each type. For safety reasons, I can't insure that they are collected in order (as they're collected along a road), and anywhere from 1 to all 4 may be present.

My idea is to calculate the straightline distances for each geopoint to allow them to be ordered by distance (either in separate fields in the main table or in a hidden join), calculate the distances between each succeeding points and then sum them up. So point 4 would be the sum of "Original to Point 1", "Point 1 to Point 2", etc. It's not exact but will likely be close enough for us

I've been thinking of ways to use the max and index functions but I'm not sure it's possible to parse out the values in this way.

The hope is to use these distances to trigger integromat workflows. Any suggestions are appreciated. 

Tags (1)
0 Kudos
0 Replies