Welcome to MapForums!

Register, sign in, or use Facebook Connect above to join in and participate in the forum.

When you are signed in, this message, the ads in this row, and the red-underlined link ads all go away.

Subscribe to receive our newsletter.
Subscribe Unsubscribe
Results 1 to 3 of 3

How can I show my current gps location in the ocx control

This is a discussion on How can I show my current gps location in the ocx control within the MapPoint Desktop Discussion forums, part of the Map Forums category; I am quite new to mappoint and I really need some help with the ocx control. I need to know ...

  1. #1
    orto is offline Junior Member White Belt
    Join Date
    Jul 2004
    Posts
    1

    How can I show my current gps location in the ocx control

    I am quite new to mappoint and I really need some help with the ocx control. I need to know what methods I can use to show my current gps location on the map. I am using a Navman gps system and can easily communicate with it using mscomm in vb6. I need to know how I can use e.g. a GPRMC string comming from the gps and show my location in the active map in the ocx control.
    Example string: "GPRMC,131513,V,6408.5567,N,02154.1982,W,0.000,0.0 ,300697,20.0,W*57"

    How can I manipulate this string to show my current location (Reykjavik, Iceland) on map using the ocx control from mappoint 2002?


    Thanks in advance.

    Orn Thorsson

  2. #2
    Anonymous is offline Senior Member Black Belt
    Join Date
    Jul 2002
    Posts
    5,137
    It would require some, but none too advanced, vb coding.

    i would assume your string has the latitude in the DDMM.MMMM format (two first digits are degrees, last are decimal minutes) and the longitude in DDDMM.MMMM. For mappoint, I assume the simplest is to transform this into the decimal degree value that is
    DD + (MM.MMMM / 60). (or DDD if its the longitude). Also note that the decimal degrees should be negative if on southern hemisphere and negative if west of greenwich. THen you can use something like:

    Dim mymap as Map
    Dim myLoc as Location
    Double lon,lat

    'here extract your lon lat in decimal degrees from the string
    mymap = MapPointControl1.activemap
    location = mymap.getLocation(lon,lat)
    mymap.addPushpin(location) 'creates a pushpin at ypu gps point
    location.goto ' zooms in and centers about your position
    mymap.altitude = mymap.altitude*1.5 'zooms out a bit.

    There you have it. Whatever else is unclear should not be too difficult to figure out from some VB tutorials.

  3. #3
    Anonymous is offline Senior Member Black Belt
    Join Date
    Jul 2002
    Posts
    5,137

    Degrees to Decimal Degrees conversion

    This is some of the worst code I've ever written, I'm ashamed of it, but it works. The input is the degrees from the NMEA sentence of your GPS.

    Private Function DegreesToDecimal(gpsdegrees As String) As Double
    'GPS gives us location in ddmm.mmmm format or dddmm.mmm format
    Dim degrees As String
    Dim minutes As String
    Dim fractionalminutes As String
    Dim decimalpoint As Integer
    decimalpoint = InStr(1, gpsdegrees, ".")
    fractionalminutes = Right(gpsdegrees, Len(gpsdegrees) - decimalpoint)
    minutes = Mid(gpsdegrees, decimalpoint - 2, 2)
    degrees = Left(gpsdegrees, decimalpoint - 3)
    'this is some of the most gawdawful uglies code I have ever written.
    DegreesToDecimal = degrees + ((minutes & "." & fractionalminutes) / 60)
    End Function

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Show toolbars in Control
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 4
    Last Post: 11-19-2004, 03:04 PM
  2. Getting current GPS coordinates in VB6
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 2
    Last Post: 06-10-2004, 06:09 PM
  3. the map is empty after Show/Hide form with MapPoint control
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 03-25-2004, 04:24 PM
  4. Show Location Info
    By mr_hypocrite in forum MapPoint Desktop Discussion
    Replies: 0
    Last Post: 08-11-2003, 12:41 PM
  5. Distance from current location to next turn point
    By dzhong in forum MapPoint Desktop Discussion
    Replies: 0
    Last Post: 12-24-2002, 02:03 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96