Can I programmingly zoom the map to a fixed nymber such 1:25000?
I see there is a slidebar for zooming. But how to do it in code?
This is a discussion on Zooming to a fixed number within the MapPoint Desktop Discussion forums, part of the Map Forums category; Can I programmingly zoom the map to a fixed nymber such 1:25000? I see there is a slidebar for zooming. ...
Can I programmingly zoom the map to a fixed nymber such 1:25000?
I see there is a slidebar for zooming. But how to do it in code?
Use the altitude property.
ExampleReturns or sets the altitude of the current map view, in GeoUnits (miles or kilometers). Lower altitudes zoom closer to the map, showing a smaller area with more detail. Higher altitudes zoom out from the map, showing a larger area with less detail. Read/write Double.[/quote]Code:Sub ZoomInBySettingAltitude() Dim objApp As New MapPoint.Application 'Set up the application objApp.Visible = True objApp.UserControl = True 'Zoom in by setting the map altitude objApp.ActiveMap.Altitude = 10 End Sub
But what is the relationship between pixelSize and Altitude? Is there a formula between them?
I'm not sure if there is some sort of formula or what, in the help file under PixelSize I found:
What is it that you are trying to do?The scale is never uniform across the screen, especially for flat maps. As the altitude is lower, the scale is more uniform.
MS have written up some code about how to convert "zoom to show X miles width" to altitude:
http://support.microsoft.com/?kbid=297348
They require screen size and resolution.
Also note the aspect ratio calculation.
I preferred to use a rule-of-thumb calculation which seems to work pretty well.
Richard
Winwaed Software Technology LLC
http://www.winwaed.com
See http://www.mapping-tools.com for MapPoint Tools
Thank you
Winwaed offers is just what I want.
Thank you again.
Chester
Hmm.. that's odd. I'll have to play with MS's stuff sometime.
I just created a tool that programatically finds all the pushpins within a certain radius of a location, draws a circle showing the radius searched and zooms to emcompass the circle drawn.
You can find my complete writeup at:
http://www.mp2kmag.com/mappoint/disc...?p=10457#10457
Basically, the altitude calculation I came up with was:
objMap.Altitude = Round(radius + (radius * 3.25))
Seems a lot simpler than MS's monitor size and all that. But maybe their thing makes sense. I havn't tested mine on multiple monitor sizes. If this information is useful and as accurate as MS's info, it can save you a lot of gobbledegook code.
-TG
There are currently 1 users browsing this thread. (0 members and 1 guests)