Android Question Current location from GPS different to google maps

Discussion in 'Android Questions' started by Albi, Mar 23, 2015.

  1. Albi

    Albi Active Member Licensed 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!
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    What is the output of Log(Location1.Latitude & " " & Location1.Longitude) ?
     
  3. Albi

    Albi Active Member Licensed User

    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:
    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:
    target1.Initialize2("12:34.5678""-12:34.5678")
    (with Dim target1 as Location in the globals sub)
     
  4. Albi

    Albi Active Member Licensed User

    aha, i have initialized the locations with latitude and longitude instead of minutes.
     
  5. Albi

    Albi Active Member Licensed User

    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)
     
  6. Albi

    Albi Active Member Licensed User

    thanks for the help Erel. And I should stop replying to this now.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice