Android Question Current location from GPS different to google maps

Albi

Active Member
Licensed User
Longtime User
Hello,

I'm comparing the (lat and long) coordinates from my current location based on the GPS tutorial with those from Google Maps (obtained via web browser). They differ a little so that the distanceTo a target (10 metres away) gives a distance returned of about 44km.

The formats differ slightly - my phone returns 12:34.567890 while Google maps gives 12.345678.
I assume that the google one is dd.mmssss to correspond to dd:mm.ssssss of the device and that this is not relevant.
If these formats are equivalent then the difference between them is 00:23.xxx for latitude and 00:08.xxx for longitude.
I did go outside to ensure accuracy.

If anyone knows what I'm doing wrong that would be great, thanks!
 
those logs give very close matches to the google maps results.
why would the bearingTo and distanceTo not work?

I changed the location sub to
Code: Copy
Sub GPS_LocationChanged (Location1 As Location)
    lblLat.Text = "Lat = " & Location1.ConvertToMinutes(Location1.Latitude)
    lblLon.Text = "Lon = " & Location1.ConvertToMinutes(Location1.Longitude)
    lblSpeed.Text = "Speed = " & Location1.Speed
    Log(Location1.Latitude & " " & Location1.Longitude) 
    edtBearing.Text = "bearing: " & Round2(Location1.BearingTo(target1)+180,2) & " distance: " & Location1.DistanceTo(target1) & "m"
End Sub

I've added 180 to get a compass bearing from 0-360 instead of -180 to 180
I didn't think this would affect the result?

The only other change was in activity_create where I added
Code: Copy
target1.Initialize2("12:34.5678", "-12:34.5678")
(with Dim target1 as Location in the globals sub)
 
Upvote 0
and if anyone else finds this thread, need to add 360 to the bearing if it's less than 0 since bearing is 0-180 for north to south and -180 to 0 for south to north (via west)
 
Upvote 0
Back
Top