ThinkGeo.com    |     Documentation    |     Premium Support

How to adjust zoom levels in latest beta

Hello,

For a long time I’ve been using this code to adjust the default zoomlevels (with zoomlevelfactor = 8) to be able to zoom in further then normal.
In the latest beta versions this is not working anymore and it will also be obsolete in the future.

    Me.ZoomLevelSet.ZoomLevel01.Scale = Me.ZoomLevelSet.ZoomLevel01.Scale
    Me.ZoomLevelSet.ZoomLevel02.Scale = Me.ZoomLevelSet.ZoomLevel02.Scale / ZoomlevelFactor
    Me.ZoomLevelSet.ZoomLevel03.Scale = Me.ZoomLevelSet.ZoomLevel03.Scale / ZoomlevelFactor
    Me.ZoomLevelSet.ZoomLevel19.Scale = Me.ZoomLevelSet.ZoomLevel19.Scale / ZoomlevelFactor
    Me.ZoomLevelSet.ZoomLevel20.Scale = Me.ZoomLevelSet.ZoomLevel20.Scale / ZoomlevelFactor

How can I get my default zoom levels back?

The suggestion mapview.ZoomScales = zoomLevelSet.GetScales() is not working and will also be obsolete soon.

Max zoomlevels in latest version (left) and current version (right).

Kind regards,
Guido van den Boom

Hi Guido,

I tested with the latest beta (ThinkGeo.Core Beta140) and the following code works fine:

var ZoomlevelFactor = 8;
MapView.ZoomLevelSet.ZoomLevel01.Scale = MapView.ZoomLevelSet.ZoomLevel01.Scale;
MapView.ZoomLevelSet.ZoomLevel02.Scale = MapView.ZoomLevelSet.ZoomLevel02.Scale / ZoomlevelFactor;
MapView.ZoomLevelSet.ZoomLevel03.Scale = MapView.ZoomLevelSet.ZoomLevel03.Scale / ZoomlevelFactor;
MapView.ZoomLevelSet.ZoomLevel19.Scale = MapView.ZoomLevelSet.ZoomLevel19.Scale / ZoomlevelFactor;
MapView.ZoomLevelSet.ZoomLevel20.Scale = MapView.ZoomLevelSet.ZoomLevel20.Scale / ZoomlevelFactor;

MapView.ZoomScales = MapView.ZoomLevelSet.GetScales();

Also I don’t see MapView.ZoomScales is marked Obsolete, can you get the latest beta and have another try?

Thanks,
Ben

Hi Ben,

This picture is what I was refering too.

‘Public Overloads Property Zoomlevelset as Zoomlevelset’ is obsolete and will be remove after v14.6.
As English is not my native language, I have no idea what this means.
To me it seems that this code for changing the default zoom scales will not work after v14.6.

Regards,
Guido van den Boom

Hi Guido,

I see. It means MapView.ZoomLevelSet is obsoleted, but you can use MapView.ZoomScales to set up the custom zooms. Here is some quick demo code:

        var zoomLevelSet = new SphericalMercatorZoomLevelSet();
        var scale0 = zoomLevelSet.ZoomLevel01.Scale;
        var zoomlevelfactor = 8;

        MapView.ZoomScales = new Collection<double>();
        for (int i = 1; i < 20; i++)
        {
            MapView.ZoomScales.Add(MapView.ZoomScales[^1] / zoomlevelfactor);  
        }

ZoomScales is a collection of scale(double) to specify the custom map zooms. It’s lightweight and easier to set up.

And just FYI, v14.3 is now available on Nuget.

Thanks,
Ben