I want to turn of zooming IN/OUT when my Bing map touches its Min and Max ZoomLevel; i.e ZoomLevel01 and ZoomLevel20.
my Questions are:
1- How and in which event I should check for current zoom level the map is in?
2- How to disable & Enable zooming IN/OUT when User zooms IN/OUT beyond these Min & Max? Because android map crashes the app when zooming out beyond zoom level 1 as calculated by:
androidMap.GetSnappedZoomLevelIndex(androidMap.CurrentScale)
[Q: Is this the right way to get current zoom level to display on a label?]
3- Or How can we stop the app from crashing when zooming OUT/IN beyond bingZoomLevelSet?
How to Limit bing map from zooming out/in beyond certain levels?
Hi Zeeshan,
Here are the answers to your questions.
Q: How and in which event I should check for current zoom level the map is in?
A: We could get current scale when it is changed in MapView.CurrentScaleChanged event. Then use GetSnappedZoomLevelIndex to get the zoom level index.
Q: How to disable & Enable zooming IN/OUT when User zooms IN/OUT beyond these Min & Max? Because android map crashes the app when zooming out beyond zoom level 1 as calculated by: androidMap.GetSnappedZoomLevelIndex(androidMap.CurrentScale) [Q: Is this the right way to get current zoom level to display on a label?]
A: Yes, that’s the right way to get current zoom level. On another hand, we have a code samples has a custom map tool which indicates how to create a control to show it on the map. Here it is: wiki.thinkgeo.com/mediawiki/images/1/13/AndroidEditionSample_GettingStarted_141211.zip
We don’t support to disable/enable the pinch zooming only. Because pinching and panning are both implemented in ExtentInteractiveOverlay. We could disable/enable them together. We could consider to add an API if necessary in the future.
We have a better idea to solve this issue; we have MaximumScale/MinimumScale property on MapView, set those properties to prevent the map zooming too deeper or too higher. Here is the code snippet.
androidMap.MinimumScale = androidMap.ZoomLevelSet.ZoomLevel05.Scale;
androidMap.MaximumScale = androidMap.ZoomLevelSet.ZoomLevel03.Scale;
Q: Or How can we stop the app from crashing when zooming OUT/IN beyond bingZoomLevelSet?
A: We tested the latest build 9.0.14.0; but we cannot recreate this issue. See our video for detail (ap.thinkgeo.com:5001/fbsharing/W2WEf7xg). If my option above doesn’t help, please try to provide us a demo so that we could understand what exactly your app is.
Hope it helps.
Thanks,
Howard