ThinkGeo.com    |     Blog    |     Wiki    |     Support

Limiting zoom levels on a map

Hi!

I have a question regarding zoom-levels on a map. I would like to limit the allowed zoom-levels on the map, so that instead of 20 different levels, you would only have around 5. I have read multiple forums posts around this, but have yet to find a good answer regarding mobile. Using the code below makes it so that the map goes white if you zoom past lower/upper scale, but I am still able to use every zoom level between 1-20 by pressing the ± buttons to zoom, or pinch to zoom.

Is it possible to only allow 5 zoom levels on the map?

At the bottom, I have a WMTS-Layer.
I then create a LayerOverlay, and add the WMTS-Layer to it.
I then again add LayerOverlay to MapView.

        ZoomLevelSet customZoomLevelSet = new ZoomLevelSet();
        customZoomLevelSet.CustomZoomLevels.Add(new ZoomLevel(1153499));
        customZoomLevelSet.CustomZoomLevels.Add(new ZoomLevel(144187));
        customZoomLevelSet.CustomZoomLevels.Add(new ZoomLevel(36046));
        customZoomLevelSet.CustomZoomLevels.Add(new ZoomLevel(4505));
  
        mapView.ZoomLevelSet = customZoomLevelSet;
        mapView.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level04;

       wmtsLayer.LowerScale = 4505;
       wmtsLayer.UpperScale = 1153499;

Hi Jehans,

The ZoomLevelBar will be consistent with the overlay when you are using LayerOverlay. Please confirm your Map overlays.

Here is one topic should be useful to you, you can refer the details by clicking following link:

If you need any more information, please let’s know that.

Thanks
Mark

Thank you Mark, that example helped me alot.

Hi Jehans,

I am glad hear that’s helpful.
Please contact us there is any issue when using MapSuite.

Thanks
Mark