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

Center Map to a pushpin?

This is a discussion on Center Map to a pushpin? within the MapPoint Desktop Discussion forums, part of the Map Forums category; Hello All - Is there a way i can center the map to a pushpin? I would like to animate ...

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

    Center Map to a pushpin?

    Hello All -

    Is there a way i can center the map to a pushpin? I would like to animate a pushpin (move), and keep the pushpin in the center of the screen as it moves.

    Thanks,
    Laz.

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

    Yes you can:

    Code:
                Location Loc = MP.ActiveMap.GetLocation(Lat, Lon, Alt);
                Pushpin  PP  = MP.ActiveMap.AddPushpin(Loc, "");
                PP.Symbol    = 1;
                MP.ActiveMap.GoToLatLong(Lat, Lon, Alt);
    The first 3 lines place the pushpin on the map, the last one center to the pushpin.

  3. #3
    Anonymous is offline Senior Member Black Belt
    Join Date
    Jul 2002
    Posts
    5,137
    Your last line gives me a Compile error with MapPoint2004...

    Expected: =

    Is there something I don't get ?

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

    Wierd. seems ok to me. ok this is copy/paste should work

    Code:
            private void testToolStripMenuItem1_Click(object sender, EventArgs e)
            {
                double Lat = 51.249434;
                double Lon = 4.483;
                Double Alt = 1;
    
                Location Loc = MP.ActiveMap.GetLocation(Lat, Lon, Alt);
                Pushpin PP = MP.ActiveMap.AddPushpin(Loc, "");
                PP.Symbol = 1;
                MP.ActiveMap.GoToLatLong(Lat, Lon, Alt);
            }
    MP is the mappoint component on the form.

  5. #5
    Anonymous is offline Senior Member Black Belt
    Join Date
    Jul 2002
    Posts
    5,137
    Hi Wilfried,
    What language are you using? I can't seem to find this fucntion GoToLatLon.

    In C++, I normally do a

    mLoc = mMap.GetLocation(dLat, dLon, dAlt);
    mpPin = mMap.AddPushpin(mLoc,"Yeehoo");

    mpPin.SetSymbol(21);
    mpPin.SetBalloonState(2);
    mLoc.GoTo();

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

    this is in C#, but should make no difference as far as it is calling the mappoint functions. Very wierd ! you can also use of course the location.Goto() or also ther is a pushpin.Goto();

  7. #7
    Anonymous is offline Senior Member Black Belt
    Join Date
    Jul 2002
    Posts
    5,137
    Very interesting, I created the C++ class wrapper by imported the type lib and I don't have these API that your C# has.
    Thanks for the information.

  8. #8
    Anonymous is offline Senior Member Black Belt
    Join Date
    Jul 2002
    Posts
    5,137
    Quote Originally Posted by Wilfried
    Hi,

    Wierd. seems ok to me. ok this is copy/paste should work

    Code:
            private void testToolStripMenuItem1_Click(object sender, EventArgs e)
            {
                double Lat = 51.249434;
                double Lon = 4.483;
                Double Alt = 1;
    
                Location Loc = MP.ActiveMap.GetLocation(Lat, Lon, Alt);
                Pushpin PP = MP.ActiveMap.AddPushpin(Loc, "");
                PP.Symbol = 1;
                MP.ActiveMap.GoToLatLong(Lat, Lon, Alt);
            }
    MP is the mappoint component on the form.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Center Point
    By colin_turner99 in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 07-14-2006, 02:38 PM
  2. Finding Center of Data
    By kerleyp in forum MapPoint Desktop Discussion
    Replies: 2
    Last Post: 08-18-2005, 04:34 PM
  3. Find center of a polygon
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 11
    Last Post: 05-25-2005, 09:54 AM
  4. Determining Center of a Zipcode
    By shaistasohail in forum MapPoint Desktop Discussion
    Replies: 0
    Last Post: 10-21-2002, 11:13 PM
  5. VB6 + ACCESS : Center to a pushpin and other things...
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 0
    Last Post: 09-05-2002, 11:40 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