ThinkGeo.com    |     Documentation    |     Premium Support

Getting zoom level from current extent changed event

hello ,
i am working on project where i want to get zoom level on current extent changed event .is there any way for it?
thanks,
hrishikesh konde.

Hi,

As below is the code:

        private void WinformsMap1_CurrentExtentChanged(object sender, CurrentExtentChangedWinformsMapEventArgs e)
    {

        Collection<double> scales = new Collection<double>();

        foreach (ZoomLevel level in winformsMap1.ZoomLevelSet.GetZoomLevels())
        {
            scales.Add(level.Scale);
        }


        int zoomlevelIndex = ExtentHelper.GetSnappedZoomLevelIndex(winformsMap1.CurrentScale, scales);
    }

Regards,

Ethan

hello,
thank you
regards,
hrishikesh konde.

Hi,

I am glad to hear that’s helpful.

Regards,

Ethan