We're trying to convert the geotrace distance value into miles and not getting the correct result. That is, when comparing our conversion to miles it's wildly different from a known segment.
We thought it was a simple meters-to-miles conversion:
round((distance(${geotraceField}) div 1609.344), 2)
But this gives different result from a known line segment distance we're drawing in Survey.
Running a simple calculation on a note field:
(distance(${geoTraceField}) div 1609.344)
Value reported: 3.00
That same length using the measure tool in an AGOL webmap:
Value reported: 1.50 miles
Simple straight distance value:
distance(${geoTraceField})
Value reported: 4880
Solved! Go to Solution.
Hi James,
Thanks for finding this! As you are probably aware, geotrace is still in-beta functionality, including associated functions like distance. I can replicate what you are seeing and will file an issue to correct this before geotrace is released.
I'm not sure why this is, but dividing the converted value from meters into miles by 2 seems to closely match the values generated in an AGOL mapviewer using the distance measure tool.
Would love to know reasons and/or if this is incorrect!
(distance(${geoTraceField}) div 1609.344) div 2
Hi James,
Thanks for finding this! As you are probably aware, geotrace is still in-beta functionality, including associated functions like distance. I can replicate what you are seeing and will file an issue to correct this before geotrace is released.
Thank you!
BTW, I'm fine with having to add an additional divisor!
Hi James,
Just so you are aware, the issue is more complicated than being simply twice the expected value- the issue is that the distance function is treating the line as if it were a polygon and adding in a final segment from the last coordinate to the first coordinate. In a straight line case (such as a 2-point line), this will be double; other cases may see varying amounts of additional distance recorded (for example, you should see essentially no difference if you recorded a closed object such as a square).