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

AddPushpin

This is a discussion on AddPushpin within the MapPoint Desktop Discussion forums, part of the Map Forums category; I have an array with 3 columns and 100 rows. The first column is name, 2nd is latitude and 3rd ...

  1. #1
    Monique is offline Junior Member White Belt
    Join Date
    Aug 2002
    Posts
    3

    AddPushpin

    I have an array with 3 columns and 100 rows. The first column is name, 2nd is latitude and 3rd is longitude.

    I want to add pushpins to a map, with locations as above. How am I supposed to do that? Coding is in Visual Basic.



    Monique
    Regards,
    Monique

  2. #2
    John Meyer's Avatar
    John Meyer is offline Senior Member Blue Belt
    Join Date
    Jul 2002
    Posts
    478
    Here is a little sample code that might help get you started. I'm using the Mappoint ActiveX control named MPC on my VB form. I'm creating a new map but you could get the activemap insted. Hope it helps.

    Dim arrData(99, 3) As String

    arrData(0, 0) = "BWI"
    arrData(0, 1) = 39.103
    arrData(0, 2) = -76.401
    arrData(1, 0) = "Duluth"
    arrData(1, 1) = 46.5033
    arrData(1, 2) = -92.1125

    Dim objmap As MapPointCtl.Map
    Set objmap = MPC.NewMap(geoMapNorthAmerica)


    For i = 0 To 99
    If arrData(i, 0) = "" Then Exit Sub
    Set objLoc = MPC.ActiveMap.GetLocation(arrData(i, 1), arrData(i, 2), 1000)
    Set objPushpin = objmap.AddPushpin(objLoc, arrData(i, 0))
    objPushpin.BalloonState = geoDisplayName
    Next

  3. #3
    amanuel is offline Junior Member White Belt
    Join Date
    Aug 2002
    Posts
    11
    Instead of using a 3 column array i think it would be easy if you created your own datatype and declare an array of your datatype and fill your data in it. For example
    1) create your own data type
    Type MPType
    Latitude as double
    Longitude as double
    Name as string
    end type
    2) declare it
    dim x(100) as MPType
    3) Fill it with your data
    x(0).Latitude=33.567
    x(0).Longitude=33.567
    x(0).Name="example"
    4)find the locations and add a pushpins
    dim g_oApp as MapPoint.Application
    dim ppin as pushpin
    dim L as location
    dim i as integer
    while(i<100)

    Set L = g_oApp.ActiveMap.GetLocation(x(i).Latitude, x(i).Longitude)
    Set ppin = g_oApp.ActiveMap.AddPushpin(L,x(i).Name)

    ppin.Symbol = g_oApp.ActiveMap.Symbols(2)
    i=i+1
    wend

  4. #4
    Monique is offline Junior Member White Belt
    Join Date
    Aug 2002
    Posts
    3

    Thank you

    These code samples of you, John and Amanuel, will help me out!


    Greetings,
    Monique Vrolijk
    Regards,
    Monique

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. addpushpin - need help to get started
    By BWard in forum MapPoint Desktop Discussion
    Replies: 7
    Last Post: 12-19-2005, 02:15 PM
  2. addpushpin problem
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 9
    Last Post: 09-28-2004, 09:12 AM
  3. AddPushPin
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 0
    Last Post: 03-01-2004, 10:41 AM
  4. addPushpin
    By nringdahl in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 01-27-2004, 09:09 AM
  5. AddPushpin with more data than Loc and name possible?
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 5
    Last Post: 03-17-2003, 06:11 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