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

Use CalcPos on a map with EXISTING pushpins ??

This is a discussion on Use CalcPos on a map with EXISTING pushpins ?? within the MapPoint Desktop Discussion forums, part of the Map Forums category; Is it possible to get the Location object of pushpins already on a map? Let's say I have 3500 Pushpins ...

  1. #1
    Sonicman_ is offline Junior Member White Belt
    Join Date
    Feb 2006
    Posts
    10

    Use CalcPos on a map with EXISTING pushpins ??

    Is it possible to get the Location object of pushpins already on a map?

    Let's say I have 3500 Pushpins saved on a file... I would like to get the Lat/Lon of those using the CalcPos routine (VBA)...

    I have used the calcpos already with success (right after creating a pishpin), I just don't know how to get the location object of pushpins already present on a map...

    Thanks all in advance for your support!

    Sonicman

  2. #2
    Wilfried is offline Senior Member Black Belt
    Join Date
    Nov 2004
    Location
    Belgium
    Posts
    2,433
    Hi,

    This gets all pushpins on the map and their Location object:

    Code:
                object o = 1;
                MapPoint.DataSet ds = mp.ActiveMap.DataSets.get_Item(ref o);
                Recordset rs = ds.QueryAllRecords();
                rs.MoveFirst();
                while (!rs.EOF) {
                    Location loc = rs.Pushpin.Location;
                    rs.MoveNext();
                }

  3. #3
    Sonicman_ is offline Junior Member White Belt
    Join Date
    Feb 2006
    Posts
    10

    Thanks....

    Thanks for the code !

    If I understand correctly, "loc" will be the location object I am looking for right ?

    I have absolutely no experience with C# code.... VB is what I know..


    Sonicman

  4. #4
    Wilfried is offline Senior Member Black Belt
    Join Date
    Nov 2004
    Location
    Belgium
    Posts
    2,433

    Re: Thanks....

    Hi,

    "loc" will be the location object I am looking for right ?
    Yes correct.

    VB is what I know..
    Yes but reading other code should be no problem. Writing in it is something different of course. If you have other questions just fire them

  5. #5
    Sonicman_ is offline Junior Member White Belt
    Join Date
    Feb 2006
    Posts
    10

    Ok I have successfully translated you code

    Here's the working code in VB format for those interested (the following displays a msgbox for each pushpin name on a current map):


    Code:
    Private Sub Commande0_Click()
    
    Dim objApp As MapPoint.Application
    Dim objMap As MapPoint.Map
    Dim objLoc As MapPoint.Location
    Dim objRecordSet As MapPoint.Recordset
    Dim objDataset As MapPoint.DataSet
    
    Set objApp = GetObject(, "Mappoint.Application.NA")
    Set objMap = objApp.ActiveMap
    Set objDataset = objMap.DataSets.Item(1)
    Set objRecordSet = objDataset.QueryAllRecords
    
    objApp.Visible = True
    objApp.UserControl = True
    
    objRecordSet.MoveFirst
    
    Do Until objRecordSet.EOF
        Set objLoc = objRecordSet.Pushpin.Location
        objRecordSet.MoveNext
        MsgBox objLoc.Name
    Loop
    
    End Sub
    Thanks for your help Wilfried. It is much appreciated !

    Sonicman

  6. #6
    Wilfried is offline Senior Member Black Belt
    Join Date
    Nov 2004
    Location
    Belgium
    Posts
    2,433
    Hi,

    I appreciate also your feedback. It will benefit lots of othr user. Glad your solution works

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Some concerns about calcpos sub
    By lucci56 in forum MapPoint Desktop Discussion
    Replies: 5
    Last Post: 07-18-2006, 11:44 AM
  2. Problems using CalcPos
    By Pete_ADL in forum MapPoint Desktop Discussion
    Replies: 4
    Last Post: 06-21-2006, 04:12 PM
  3. Looking for existing app to meet needs
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 03-01-2004, 12:44 PM
  4. Confused with calcpos :s
    By Matrices in forum MapPoint Desktop Discussion
    Replies: 4
    Last Post: 09-25-2003, 10:30 AM
  5. Is it possible to add a new point to an existing p....
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 09-17-2001, 02:38 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 84 85 86 87 88 89 90 91 92 93 94 95 96