# Improving accuracy of $GeoLocation in wolfram cloud forms The four commands Here CloudEvaluate[Here] CloudEvaluate[FindGeoLocation[]] CloudEvaluate[$GeoLocation]


all give wildly different results. None of them are correct (some even showing a different country). I assume that CloudEvaluate[Here] gives the location of the Wolfram Cloud server, but why is that different from the other CloudEvaluate commands?

I wish to create a FormPage in the Wolfram cloud where I can enter some data via my phone, including the phone's current location. How do I access the phone's GPS readings from a Wolfram cloud FormPage?

• I thought that this one is a duplicate 116508 but the fact it is about APIFunction not a FormPage makes it different. – Kuba Jan 29 '19 at 13:51

This seems to work well, it will ask you to give permissions to access gps data and then our JS will initialize "yourPosition" field with coordinates taken from navigator (see: https://www.w3schools.com/html/html5_geolocation.asp)

    CloudDeploy[
FormPage[{
EmbeddedHTML @ StringJoin[
"<script>function initYourPosition( position ) { document.getElementsByName('yourPosition')[0].value = ''+position.coords.latitude+','+position.coords.longitude;}</script>"
, "<script>navigator.geolocation.getCurrentPosition(initYourPosition)</script>"
]
, "yourPosition"->"GeoCoordinates"
}
, GeoGraphics[{ GeoMarker[#], Inset[#2,#]}& @@@ {
{Here,"\nHere"},
{$$GeoLocation,"$$GeoLocation"},
{FindGeoLocation[],"FindGeoLocation"},
{#yourPosition,"navigator.geolocation"}
},
GeoRange->Quantity[6,"Kilometers"],
GeoZoomLevel->Automatic,
GeoCenter->#yourPosition
] &
]
, CreateUUID["temp/"]
, Permissions -> "Public"
]


And the final result after allowing access and submitting:

I found a a Community.wolfram.com post that does even more: Exact GeoPosition from FormFunction but requires a little bigger html+js template.