Create conditions "GPS from the device matches the predefined coordinates"

Hello,
I am a complete layman and beginner. I would like to set the condition on the button, so that the next page opens after clicking, if the condition is met: the GPS signal from the device will match the pre-entered coordinates. For a better explanation, I give an example: I have to find the specified place in the terrain according to the indications. When I think I found it, I press the button “I’m here” and if the current position matches the one entered, the next page in the app will open.
Can anyone please help me with instructions on how to do this? Thanks!

Hi @Diana_Vidova,

first I have to say that unfortunately, the GPS functions on Android are not working well yet but I really hope this is fixed at some point.
Assuming that the GPS functions are working (e.g. Get GPS Position function from marketplace), you best create a custom Javascript function which calculates the distance to a predefined GPS coordinate like this:
lat1 = inputs[“lat1”];
lon1 = inputs[“lon1”];
lat2 = inputs[“lat2”];
lon2 = inputs[“lon2”];
unit=“K”;

if ((lat1 == lat2) && (lon1 == lon2)) {
return { result:0 };
}
else {
var radlat1 = Math.PI * lat1/180;
var radlat2 = Math.PI * lat2/180;
var theta = lon1-lon2;
var radtheta = Math.PI * theta/180;
var dist = Math.sin(radlat1) * Math.sin(radlat2) + Math.cos(radlat1) * Math.cos(radlat2) * Math.cos(radtheta);
if (dist > 1) {
dist = 1;
}
dist = Math.acos(dist);
dist = dist * 180/Math.PI;
dist = dist * 60 * 1.1515 * 1000;
if (unit==“K”) { dist = dist * 1.609344 }
if (unit==“N”) { dist = dist * 0.8684 }
return { result:dist };
}

If you have a couple of coordinates to check against, you need to pass the list in.

Hope this helps a bit.

Best,
Jo