Community of VE/MapPoint Users and Developers
This is a discussion on Zoom to Waypoint within the MapPoint 2006/2009 Discussion forums, part of the Map Forums category; having a problem zooming to a waypoint. I have a route setup but cannot figure out how to zoom to ...
| |||||||
| Register | Blogs | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| |||
| Zoom to Waypoint also - zoom to route. this is an option in the EXE but i cannot find out how to do in code. using VB.NET with MP2K thanks in advance. |
| |||
| Zoom to Waypoint
To zoom to a single waypoint, try the following untested code: Code: mpApp.ActiveMap.ActiveRoute.Waypoints.Item(1).Location.GoTo
mpApp.ActiveMap.Altitude = 10 ' Or whatever
Code: mpApp.ActiveMap.Union(wp1, wp2, wp3).GoTo |
| |||
| Proper Altitude Calculation and finding points within radius
I just got done a little project and wanted to share something I figured out in case it helps other people who might have similar issues. Tasks: Given a point, find all pushpins within XX miles radius of that point. Also draw a circle showing the search area and zoom the image to show the full circle. Assuming you've already plotted your pushpins, gotten the Location Object for your search point and determined what radius you want to use. Here's how you do each step: Code: ' Set altitude/zoom ' Notes: This was determined by trial and error but seems to work great objMap.Altitude = Round(radius + (radius * 3.25)) Code: ' Draw circle ' Notes: Ok, is MS just confused? They say 'radius' but they must mean ' X diameter and Y diameter. So we multiple radius by 2 objMap.Shapes.AddShape geoShapeOval, objORGLoc, radius * 2, radius * 2 Code: ' Find all pushpins within the circle
' Notes: objORGLoc is my 'origin location', the point I'm searching from
' orig_org is the name of the origin, the IF statement makes sure to
' exclude the pushpin for the origin location
' I also draw a line from origin to the pushpin to make it more visible
Set objRecords = objMap.DataSets.Item(1).QueryCircle(objORGLoc, radius)
objRecords.MoveFirst
Do While Not objRecords.EOF
If objRecords.Pushpin.Name <> orig_org Then
lngCount = lngCount + 1
i = lngCount + 24
Range("A" & i).Value = objRecords.Pushpin.Name
Range("B" & i).Value = Round(objORGLoc.DistanceTo(objRecords.Pushpin.Location))
Set objLine = objMap.Shapes.AddLine(objORGLoc, objRecords.Pushpin.Location)
objLine.Line.Weight = 1
objLine.Line.ForeColor = vbBlue
'objLine.ZOrder geoSendBehindRoads
objLine.Line.EndArrowhead = False
End If
objRecords.MoveNext
Loop
I thought with the radius/diameter mixup and the trial and error on the altitude calculation, that this information might be helpful to someone. |
| |||
|
Ok, I found another article that says that the zoom/altitude setting varies by screen size and resolution. Here's an article MS published on how to get the accurate zoom no matter what resolution or screen size: http://support.microsoft.com/?kbid=297348 For reference, the application I was using was an Excel spreadsheet with MP embedded. A pretty small little box containing mappoint (too lazy to measure pixels right now, but it spans from A4 to F20 approx with roughly default Excel cell sizes... yeah, I'm being seriously lazy here, just aiming for a ballpark # to share with you guys). -TG |
![]() |
| Tags |
| waypoint, zoom |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
| |
| ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Geocoordinates from a waypoint | chpw | MapPoint 2006/2009 Discussion | 6 | 04-05-2006 10:53 AM |
| address from waypoint | starbuck | MapPoint 2006/2009 Discussion | 7 | 11-18-2003 09:04 AM |
| Put a waypoint! | Anonymous | MapPoint 2006/2009 Discussion | 1 | 11-14-2003 10:44 AM |
| Zoom In and Zoom Out event detection | victorf | MapPoint 2006/2009 Discussion | 2 | 10-22-2003 01:56 AM |
| Route Waypoint Name | Vic | MapPoint 2006/2009 Discussion | 1 | 10-03-2002 04:00 PM |