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 10 of 10

Help.! How to move a pushpin in the map.

This is a discussion on Help.! How to move a pushpin in the map. within the MapPoint Desktop Discussion forums, part of the Map Forums category; Hi, I have a text file with gps coordinate. (North of France) Latitude Longitude 50.637557 3.071025 (a) 50.638118 3.070740 (b) ...

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

    Help.! How to move a pushpin in the map.

    Hi,
    I have a text file with gps coordinate. (North of France)
    Latitude Longitude
    50.637557 3.071025 (a)
    50.638118 3.070740 (b)
    50.638902 3.070188 (c)
    50.639385 3.069855 (d)

    I make a prog with VBasic for move a pushpin in the XY Location a -> b -> c -> d.

    Here 's my code:

    Private Sub Form_Load()

    Dim objMap As MapPointCtl.Map
    Dim objLoc As MapPointCtl.Location
    Dim Loc As MapPointCtl.DataSet
    Dim objPin_A As MapPointCtl.Pushpin

    MappointControl1.NewMap geoMapEurope
    Set objMap = Form1.MappointControl1.ActiveMap
    Set Loc = objMap.DataSets.ImportData("c:\gps01.txt")

    objMap.DataSets.ZoomTo

    End Sub


    But, I have just my 4 pushpin in the map.
    What's the solution for move a pushpin.

    Thank's.

  2. #2
    John Meyer's Avatar
    John Meyer is offline Senior Member Blue Belt
    Join Date
    Jul 2002
    Posts
    478
    You will need to delete pushpin the add it at new location.

  3. #3
    Anonymous is offline Senior Member Black Belt
    Join Date
    Jul 2002
    Posts
    5,137
    Quote Originally Posted by John Meyer
    You will need to delete pushpin the add it at new location.
    Thank's for you answer
    But what is the method for delete a pushpin.
    Or for put the location in a table (array)
    have you a sample...

    Thank's

  4. #4
    John Meyer's Avatar
    John Meyer is offline Senior Member Blue Belt
    Join Date
    Jul 2002
    Posts
    478
    To delete a pushpin named "testpin"

    Code:
    Set objmap = GetObject(, "MapPoint.Application").ActiveMap
    Set objPin = objMap.FindPushpin("testpin")
    objPin.Delete
    As far as putting the location in a table (arrray) you need to check out this article that shows you how to get the lat/long of a pushpin

    http://www.mp2kmag.com/articles.asp?ArticleID=13

  5. #5
    Anonymous is offline Senior Member Black Belt
    Join Date
    Jul 2002
    Posts
    5,137
    Thank's John.

    A last question.
    When I put this code line,
    Code:
    Set objMap = Form1.MappointControl1.ActiveMap
        Set Loc = objMap.DataSets.ImportData("c:\gps01.txt")
    and my gps01.txt is:
    • Latitude Longitude
      50.637557 3.071025
      50.638118 3.070740
      50.638902 3.070188
      50.639385 3.069855
      50.639489 3.069977


    I'have my 5 Pushpin on the map. I don't want that.
    I just want put my data on a Array and after show my pushpin with a time delay.(they must move and a road)
    Tank's ,
    Not, I begin with VB.

  6. #6
    John Meyer's Avatar
    John Meyer is offline Senior Member Blue Belt
    Join Date
    Jul 2002
    Posts
    478
    I think you may have to write a routine to read the text file and fill the array yourself. Here is some sample code that might help you.

    Code:
    Dim objmap As MapPointCtl.Map
    Set objmap = MappointControl1.ActiveMap
    Dim objPushPin As MapPointCtl.Pushpin
    
    Dim objLocs(1 To 5) As MapPointCtl.Location
    Set objLocs(1) = objmap.GetLocation(50.637557, 3.071025)
    Set objLocs(2) = objmap.GetLocation(50.638118, 3.07074)
    Set objLocs(3) = objmap.GetLocation(50.638902, 3.070188)
    Set objLocs(4) = objmap.GetLocation(50.639385, 3.069855)
    Set objLocs(5) = objmap.GetLocation(50.639489, 3.069977)
    
    
    For i = 1 To 5
    Set objPushPin = MappointControl1.ActiveMap.AddPushpin(objLocs(i), "testpin")
    objPushPin.Location.GoTo
    objmap.Altitude = 2
    
    'put you delay routine here?
    
    Next

  7. #7
    Anonymous is offline Senior Member Black Belt
    Join Date
    Jul 2002
    Posts
    5,137
    Thank's a lot John.
    I try it and it fine.
    But if I want to put my data in a array, I take a msdn example:

    Code:
    Sub ImportFromMultipleSources()
    
      Dim mpApp As MapPoint.Application
      Dim mpDatasets As MapPoint.DataSets
      Dim mpDataSet As MapPoint.DataSet
      Dim myExampleArray(2, 2)
    
      'Start MapPoint
      Set mpApp = New MapPoint.Application
      mpApp.Visible = True
      mpApp.UserControl = True
    
      'Get the DataSets collection
      Set mpDatasets = mpApp.NewMap.DataSets
    
      'Create the ArrayOfFields descriptions
    
      'Field is specified by name
       myExampleArray(1, 1) = "Latitude"
      'tells MapPoint to use this field as the latitude field
       myExampleArray(1, 2) = geoFieldLatitude
    
      'Field again specifed by name
      myExampleArray(2, 1) = "Longitude"
      'tells MapPoint to use this field as the longitude field
      myExampleArray(2, 2) = geoFieldLongitude
    
       'Perform the import
      Set mpDataSet = mpDatasets.ImportData("c:\gps01.txt", myExampleArray)
    
      'The (x,2) elements are of the type GeoFieldType or string.
      'If string, then they set the new name of the field, and
      'MapPoint assumes that the field is a nongeocoding data field.
    
    End Sub
    And the compil VB doesn't want the declaration.
    Why.?
    Thank's another

  8. #8
    John Meyer's Avatar
    John Meyer is offline Senior Member Blue Belt
    Join Date
    Jul 2002
    Posts
    478
    Did you add a reference to the the MapPoint type library?

    In Visual Basic choose References on the Project menu and check the box for Microsoft MapPoint 9.0 Object Library

  9. #9
    Anonymous is offline Senior Member Black Belt
    Join Date
    Jul 2002
    Posts
    5,137
    i use this code to show where i am with using data form my gps. but all the pushpins stay on the map. how can i just show the last pushpin, or is there another way to show your GPS position?

  10. #10
    larry_llama is offline Member Yellow Belt
    Join Date
    Dec 2002
    Posts
    35
    To create the pushpin:

    Dim oPin1 As MapPointCtl.Pushpin
    Set oPin1 = MappointControl1.ActiveMap.AddPushpin(MappointCont rol1.ActiveMap.GetLocation(0, 0), "currentLoc")

    Later you can move the pushpin (if the pin object is not public, then you have to find the pushpin by using its name first):

    Set oPin1 = MappointControl1.ActiveMap.FindPushpin("currentLoc ")
    Set oPin1.Location = MappointControl1.ActiveMap.GetLocation(latitude, longitude, altitude)

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Pushpin move on map and new locaiton
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 2
    Last Post: 01-28-2005, 02:26 PM
  2. not to move shapes
    By Manuel in forum MapPoint Desktop Discussion
    Replies: 2
    Last Post: 05-19-2003, 01:46 PM
  3. Capture the Pushpin move event
    By Maverick in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 04-14-2003, 01:34 AM
  4. Ist it possible to get X, Y from mouse move
    By blackmap in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 12-16-2002, 03:54 PM
  5. It is possible to drag / drop (move) an PushPin on....
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 12-03-2001, 02:54 AM

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