Save the length between a real (tablet) location and a location chosen on the map

329
1
06-16-2021 02:33 AM
Konstantin
New Contributor

Is it possible to collect the length between a real (tablet) location and a location chosen on the map? It's required to verify that the information is collected from visited locations. I can see the length on my screen (see attached image), but how to add it as attribute data?

Tags (1)
0 Kudos
1 Reply
DougBrowning
MVP Esteemed Contributor

I show this using Arcade, which is not really an attribute but it may help you.  I also have code to do this in 123 where I warn then if they are too far from coords that I pass into the form.

In this case I am comparing static lat longs to calculated to see if anyone moved my points.  You could also use FeatureSet to lookup to another layer.

Current point distance from design (meters)
var originShift = 2.0 * PI * 6378137.0 / 2.0;
var lon = (Geometry($feature).x / originShift) * 180.0;
var lat = (Geometry($feature).y / originShift) * 180.0;

lat = 180.0 / PI * (2.0 * Atan( Exp( lat * PI / 180.0)) - PI / 2.0);

return Round(Acos(Sin(lat * PI / 180)*Sin($feature.DesignLat * PI / 180) + Cos(lat * PI / 180)*Cos($feature.DesignLat * PI / 180)*Cos(($feature.DesignLong * PI / 180)-(lon * PI / 180))) * 6371000,2)

0 Kudos