ThinkGeo.com    |     Documentation    |     Premium Support

Why I can't change the CurrentScale Property?

Hi, 

I want to zoom my map to a certain sacle, But it works not well.

for example,I want to zoom my map to 5000, so using the following code :

            double scale = Convert.ToDouble(5000, CultureInfo.InvariantCulture);        

            winformsMap1.ZoomToScale(scale);  

            winformsMap1.Refresh(); 

but it not works as my expectation. I debug the codes , when I had executed the follwing two lines

            double scale = Convert.ToDouble(5000, CultureInfo.InvariantCulture);        

            winformsMap1.ZoomToScale(scale);  

I think the value of "winformsMap1.CurrentScale" is should be 5000,but it is 9011.71554565483.

Then, I debug Samples "zoom to a certain sacle",it is the same,It not works well too.

The version of my thinkgeo  MapSuite is  V3.0.415 RC2 .

that is why ? I'm expecting  your reply.

thnank you very much!

 



Hi Senlin,


By default, the map control snaps to the nearest ZoomLevel’s scale when you change the current extent (or scale) on it. So when you call the method ZoomToScale() it will not really zoom to the scale you passed in if the scale doesn’t belong to any zoom level.
 
To solve this problem, you can change the ZoomLevelSnapping property of the map control like this:
 

winformsMap1.ZoomLevelSnapping = ZoomLevelSnappingMode.None;

 
Any more questions please let me know.
 
Thanks,
 
sun