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

How-to set map location to make set of points visisble

This is a discussion on How-to set map location to make set of points visisble within the MapPoint Desktop Discussion forums, part of the Map Forums category; I am using the MapPoint 2002 control in a Visual Basic application. I have a problem which I can't seem ...

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

    How-to set map location to make set of points visisble

    I am using the MapPoint 2002 control in a Visual Basic application. I have a problem which I can't seem to figure out. I've got a set of geographic locations ( lats/lons ) and I am trying to figure out how I can calculate the best location to set the map object's location to ( lat, lon and altitude ) so that all of these points are visible on the screen. The altitude should be the lowest possible altitude were all the points are visible.

    The map is using the orthographic projection ( m_oMap.Projection = geoGlobeViewWhenZoomedOut ) but all my points are within North America so there is never a concern about a point being on the other side of the globe.

    Also, the aspect ratio of the map is not fixed. If the aspect ratio was fixed, I could come up with a suitable solution.

    Does anybody know of an algorithm I can use to solve this problem. My best (not very good) method right now is to calculate the range of coordinates of all these points and use the center of the bounding box of these points as my map location and then estimate the best altitude. My problem is that sometimes my altitude is far higher than it needs to be.

    Thanks for any assitance.

  2. #2
    Mossoft is offline Member Yellow Belt
    Join Date
    Feb 2003
    Posts
    48
    You could use the datasets ZoomTo method and let MP do the thinking:

    objMap.DataSets("My Pushpins").ZoomTo


    M.

  3. #3
    Anonymous is offline Senior Member Black Belt
    Join Date
    Jul 2002
    Posts
    5,137
    Thanks Mossoft but I am not working with DataSets. I am strictly working with Lats/Lons. Unless there is a way to create a dataset programically which is not displayed on the map then I can use this method. I've looked into that and to me it doesn't look like I can do that.

    Thanks again.

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

    How-to set map location to make set of points visisble

    Have you tried using the GetLocation method to get an object location for each set of Lat/Lon coordinates then using the Union method with the array of object locations.

    Set objLoc1 = objMap.GetLocation(Lat1, Lon1)
    Set objLoc2 = objMap.GetLocation(Lat2, Lon2)
    etc.

    objMap.Union(Array(objLoc1, objLoc2)).GoTo

    Presumably this can be extended to cover more locations

    objMap.Union(Array(objLoc1, objLoc2, ---- etc. )).GoTo

    Quote from the Union Method:

    "Returns a Location object that represents the best map view to display all of the specified locations."


    RVH.

  5. #5
    Anonymous is offline Senior Member Black Belt
    Join Date
    Jul 2002
    Posts
    5,137
    Thanks a lot RVH, that certainly seems to work quite well. I haven't tested it out in terms of performance over time with many points but I think this may be the answer.

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

  7. #7
    Gryffyn is offline Junior Member White Belt
    Join Date
    May 2004
    Posts
    9
    In case this is useful to you. I just posted some information about calculating altitude based on a circular area/radius around a location.

    The information can be found at:

    http://www.mp2kmag.com/mappoint/disc...?p=10457#10457


    Basically I determined that:

    objMap.Altitude = Round(radius + (radius * 3.25))

    Don't ask.. I have a lot of free time.. sometimes. hah.

    Sounds like you pretty much got your issue figured out and if you used this, you'd still have to figure out the radius to use, but more information is better than not enough eh?

    Good luck!

    -TG

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. How to make shapes unmoveable ?
    By Jaba in forum MapPoint Desktop Discussion
    Replies: 6
    Last Post: 01-12-2005, 05:03 AM
  2. $$$ Will Pay for A Way to Make a Map $$$
    By webdbx in forum MapPoint Desktop Discussion
    Replies: 4
    Last Post: 07-28-2004, 08:38 AM
  3. How to make invisible a pushpin
    By clavijo in forum MapPoint Desktop Discussion
    Replies: 2
    Last Post: 07-09-2004, 07:41 AM
  4. Make New own baseMap
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 12-03-2003, 10:02 AM
  5. trying to make a 'locator map'
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 0
    Last Post: 04-09-2003, 04:37 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