This project has moved and is read-only. For the latest updates, please go here.

Zoom levels when changing tilelayer

Apr 15, 2013 at 11:24 AM
Not sure if I've been handling min and max zoom right but I have had to comment out the minzoomlevel logic in TileLayer::SelectTiles. I discovered that when you change the map layer this code zooms from your min zoom to your current zoom. This kills our geoserver as it requests tiles for the whole world first and zooms in.. Our tile layer is down to street level so it kills it ! Commenting out the min zoom bit seems to do the trick but not sure if thats broken the minzoom logic. Why do you request multiple zoom layers anyway??

        protected void SelectTiles()
            var maxZoomLevel = Math.Min(zoomLevel, MaxZoomLevel);
            var minZoomLevel = maxZoomLevel;
            var container = TileContainer;

            //if (container != null && container.Children.IndexOf(this) == 0)
            //    minZoomLevel = MinZoomLevel;

            var newTiles = new List<Tile>();
            for (var z = minZoomLevel; z <= maxZoomLevel; z++)
.. go off an get tiles for this zoom level
Apr 15, 2013 at 4:51 PM
Edited Apr 15, 2013 at 6:02 PM
This is by design. It simply loads all tiles from lower zoom levels that cover the currently visible area to support smooth zooming out. If you omit this behaviour, you will get an empty map every time the zoom level changes to the next lower level while you zoom out.

Having said that I realized that there are really a few tiles too much requested. I'm going to rework this and I guess I'll also add a property that let you disable this feature entirely.

You may also want to read the documentation of the Bing Maps Control's UpSampleLevelDelta property, which controls a similar feature. See here:
Apr 15, 2013 at 6:20 PM
Added property LoadLowerZoomLevels.
Apr 22, 2013 at 8:13 PM
I modified your code to go from the previous lower level (i.e. delta of 1) and that seems to work quite well.