GPSDriver giving wrong lat/lon data?

Discussion in 'Questions (Windows Mobile)' started by mr.kabelbinder, Apr 9, 2009.

  1. mr.kabelbinder

    mr.kabelbinder New Member Licensed User

    Hello forum,

    I do have a strange effect using GPSDriver on a WM5 device with built-in GPS.

    The device in question is a Mio A701. Basic4PPC is version 6.05, GPSDriver v1.11. A little test-app (just showing lat/lon and some other values) does work correctly in that it give back values, correct satellite counts etc.

    BUT: The lat/lon reported look very strange - I get values like 4776.6586 for latitude and 1085.0136 for longitude. Given the docs those values should be degrees, so I obviously do have a problem here ;-).

    Other GPS apps on the same device work OK and give correct position data (like iGo navigation system, odgps etc.).

    Has anyone else observed such a strange behaviour? Might it be the slightly older Basic4PPC version?
    Or do I simply mis-interpret the data?

    Any help or hint is greatly appreciated!

  2. agraham

    agraham Expert Licensed User

    Can you post your test app? What should the lat/long be for the example you gave?
  3. mr.kabelbinder

    mr.kabelbinder New Member Licensed User

    I reverted back to a fairly standard GPS test app, still the same effect.
    Here's the relevant part of the source code:

    Sub App_Start
       Label1.Text = 
    "Trying to connect..."
       Label1.Visible = 

    If gps.Opened = True Then
          Label1.Text = 
    "gps is open."
          Timer1.Interval = 
          Timer1.Enabled = 
          Label1.Text = 
    "gps failed to open."
    End If
    End Sub

    Sub Timer1_Tick
    If gps.GetGpsData(6000) = True Then Displaygps
    End Sub

    Sub DisplayGps
    "Service status: " & gps.ServiceState)
    "Device status: " & gps.DeviceState)
    "Fix: " &  gps.FixType)
    "Driver prefix: " &  gps.DriverPrefix)
    If gps.MagneticVariation <> gps.InvalidData Then lstData.Add("Magnetic variation: " &  gps.MagneticVariation)
    If gps.PositionDilutionOfPrecision <> gps.InvalidData Then lstData.Add("PDOP: " & gps.PositionDilutionOfPrecision)
    If gps.SatelliteUsedCount <> gps.InvalidData Then lstData.Add("Satellites in use: " & gps.SatelliteUsedCount)
    If gps.Time <> 0 Then lstData.Add("Time: " & Date(gps.Time) & " " & Time(gps.Time))
    If gps.Latitude <> gps.InvalidData AND gps.Longitude <> gps.InvalidData Then
    "Lat: " & Round(gps.Latitude))
    "Lon: " & Round(gps.Longitude))
    End If
    If gps.SeaLevelAltitude <> gps.InvalidData Then lstdata.Add("SeaLevelAltidute: " & gps.SeaLevelAltitude)   
    If gps.EllipsoidAltitude <> gps.InvalidData Then lstdata.Add("EllipsoidAltitude: " & gps.EllipsoidAltitude)   
    If gps.Speed <> gps.InvalidData Then lstdata.Add("Speed: " & gps.Speed * 1.852)
    If gps.Heading <> gps.InvalidData Then lstdata.Add("Course: " & gps.Heading)
    End Sub
    A current example for coordinates from my test app would be:
    I get
    latitude "4748.6319"
    longitude "1032.8675"

    I just stumbled upon how to interpret this, but that's not the way it SHOULD be in my understanding. This actual position is
    lat 47° 48.6319'
    lon 10° 32.8675'

    but expressing this correct position as decimal degrees should read
    lat 47.81053167
    lon 10.54779167
    or am I wrong?

    And what would the output look like if I have a position with a one-digit or three-digit degree for the lat/lon?

    I'm confused :)

  4. agraham

    agraham Expert Licensed User

    I wanted a runnable app that fails on your system so that I can try it on a couple of mine and see if I get the same result. a code fragment tells me nothing.

    EDIT: - I meant the full code for a runnable app so I can play with it.
  5. mr.kabelbinder

    mr.kabelbinder New Member Licensed User

    Sorry, misunderstanding ;-)

    I attach the source code and the compiled EXE for the device.

    Thanks for taking a look into this!


    Attached Files:

  6. agraham

    agraham Expert Licensed User

    Your source code, unchanged, returns the correct latitude and longitude for my location when run on my HTC Touch Diamond with internal GPS - this is not surprising as this is the device I used to develop the original version of GPSDriver for Erel. I have also tried it on my iPAQ214 with an external Fuzion Bluetooth GPS and that worked correctly too.

    From the information you gave in a previous post it looks to me as though there is a bug in your device. GPSDriver calls the Windows GPS Intermediate Driver directly, not a COM port, to access GPS data and the data is provided ready parsed, not as NMEA sentences. The data it is providing you with appears to be in the format of the original NMEA string which is "ddmm.mmm". It should be converting this to "dd.dddd" but it looks like it is not and it seemsto be passing it through unchanged.

    Your other GPS apps probably work because they are using the GPS either directly through a COM port or indirectly through a virtual COM port set up by the GPS Intermediate Driver. Which of these it is depends upon how you have set up the device and the apps. In either case they will be receiving data as NMEA sentences whixh is what they expect from a COM port, and not the ready parsed GPSDriver data. Presumably the original NMEA data is being passed through correctly.
  7. mr.kabelbinder

    mr.kabelbinder New Member Licensed User

    Yep, makes sense. Seems like the intermediate driver is just passing the NMEA formatted data through. And I confirmed the other two apps work directly on the COM ports.

    So I'll have to deal with this bug on this development device and make sure there's no such bug on the production devices (which are completely different).

    Thanks for opening my eyes ;-)

  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