Select to view content in your preferred language

Zoom to a set scale similar to ArcIMS

2243
2
01-06-2012 03:41 PM
ChristineZeller
Occasional Contributor
I was wondering if there was an that showed how to set up a task to zoom to set scale (user types in the scale or maybe even a drop down/combo box with some predefine scales; ex 1:200, 1:400, 1:1000).  I was thinking since most of use have our imagery cached at standard ESRI scales or are using ESRI imagery services maybe there is a way just to take advantage of that.  It seems like the navigation zoom in and zoom out toolbar is following the cached  tiling scheme / define scales levels of the cache.

Any help or reference would be great!

Thanks
Chris
0 Kudos
2 Replies
DominiqueBroux
Esri Frequent Contributor
It seems like the navigation zoom in and zoom out toolbar is following the cached tiling scheme / define scales levels of the cache.

That's depending on the 'SnapToLevels' map property. If you set it to false, you will be able to zoom at any scale.


I was wondering if there was an that showed how to set up a task to zoom to set scale (user types in the scale or maybe even a drop down/combo box with some predefine scales; ex 1:200, 1:400, 1:1000).


From 2.3, scale support has been added to the Map. See a sample here : http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#MapScale


Nevertheless the Scale property is read-only. To change the scale you can use ZoomToResolution.

Code snippet setting the map scale to 1:10000 :

double expectedScale = 10000.0;
map.ZoomToResolution(map.Resolution * expectedScale / map.Scale);


Note : Take care that 'map.Scale' is not really the scale but the scale denominator.
0 Kudos
dotMorten_esri
Esri Notable Contributor
Also note that this assumes your monitor has a DPI of 96 (which it most likely doesn't).
0 Kudos