ThinkGeo.com    |     Documentation    |     Premium Support

+ button (zoom in) doesn't work as expected with MinimumScale = 0

Hi,

If I set MinimumScale = 0 I can zoom in using 2 fingers, but after a lot of zoom in the + button does not zoom anymore and the zoom - go back too much.

Maybe it is related with the zoomlevelset (im using the OpenStreetMapsZoomLevelSet), but I feel it is not normal that I can zoom in using 2 fingers but I cannot using on map button.

Could you explain ?

here is a sample to illustrate:
1 - zoom with the + button until you cannot zoom anymore
2 - zoom using your finger

=> why the + button and finger does not have the same funcionality ? my client are a bit disapointed by this so I need a solution.

AndroidOSM.zip (87.6 KB)

Hi Judicael,

I was able to get your sample running - thanks for including it!

Does this issue occur only when deployed to a physical android device? Or does it also occur in the emulator? And if it occurs in the emulator, do you use + mouse drag to simulate the finger zoom you mention in #2?

When I run this in my Visual Studio emulator, the pinch zoom does not zoom in further than the ‘+’ button.

If this does occur for you in the Visual Studio emulator, please include details on what version of Android you’re targeting in the emulator.

Thanks,
John

Due to virtualization, I cannot run it on emulator. It occurs on real device.
If I create a new zoomlevelset with more level, I can zoom in using finger, i can zoom out using the - button (and it work well this time, zooming out one level at a time) but I cannot zoom in using the + button after level 20

Thanks Judicael,

I can recreate the issue you’re describing on both an emulator and physical device. I can also recreate it on standard ZoomLevelSets, so it’s not isolated to just the OSM set.

I will bring this up with the product team tomorrow and they can prioritize this into a future beta build.

Thanks,
John

Hi Judicael,

Zoom in/out button locates at the mapView’s zoomlevel, so the lowest scale we can go through zoom buttons is the scale of zoomlevel20, which happens to be something around 560.

Stretching zooming doesn’t have to reside at a certain scale so it can go as deep as MapView’s Minimum Scale, which by default is 200. This is why after you zoom in to scale 560 through zoom buttons, you can still zoom in to scale 200 through stretch zooming.

You can avoid this by simply setting the mimmumScale the same as zoomlevel20’s scale, here is the code.
mapView.MinimumScale = mapView.ZoomLevelSet.ZoomLevel20.Scale;

We’ve written it down and see how we can make it consistent in future versions.

Thanks,
Ben

Judicael,

Also here is a sample how you can create a custom zoomlevelset with one more level, this gives your map zooming one level deeper (to scale 280).

var newZoomLevelSet = new ZoomLevelSet();
var baseScale = mapView.ZoomLevelSet.ZoomLevel01.Scale;
for (int i = 0; i < 21; i++) 
    newZoomLevelSet.CustomZoomLevels.Add(new ZoomLevel(baseScale / Math.Pow(2, i)));
mapView.ZoomLevelSet = newZoomLevelSet;
mapView.MinimumScale = newZoomLevelSet.CustomZoomLevels[20].Scale;

Thanks,
Ben