GMap caches tiles not in the zoom level range

Topics: Bugs
Jun 26, 2013 at 1:44 PM
Hi radioman,

In the latest build tiles outside the range provide by MinZoom and MaxZoom are cached in the background. In the stable 1.6 release this is not an issue.

Debug output:
A first chance exception of type 'System.Net.WebException' occurred in System.dll
GetImageFrom: System.Net.WebException: The remote server returned an error: (404) Not Found.
at System.Net.HttpWebRequest.GetResponse()
at GMap.NET.MapProviders.GMapProvider.GetTileImageUsingHttp(String url) in C:\Marcel\Repo\greatmaps_54bd9b1cd62d\GMap.NET.Core\GMap.NET.MapProviders\GMapProvider.cs:line 422
at GMap.NET.MapProviders.AmsterdamMapProvider.GetTileImage(GPoint pos, Int32 zoom) in C:\Marcel\Repo\greatmaps_54bd9b1cd62d\GMap.NET.Core\GMap.NET.MapProviders\Vcs\AmsterdamMapProvider.cs:line 159
at GMap.NET.GMaps.GetImageFrom(GMapProvider provider, GPoint pos, Int32 zoom, Exception& result) in C:\Marcel\Repo\greatmaps_54bd9b1cd62d\GMap.NET.Core\GMap.NET\GMaps.cs:line 785

ZoomLevel 6 does not exists on the tile server.
MaxZoom is set to 19 and MinZoom is set to 11.

For now I use this work around in the custom provider:
   private int internalMinZoom = 11;
   private int internalMaxZoom = 19;

  public override PureImage GetTileImage(GPoint pos, int zoom)
     // no use to return zoom levels the tile server doesn't provide
     if (zoom < internalMinZoom && zoom > internalMaxZoom) return null;

     string url = MakeTileImageUrl(pos, zoom, LanguageStr);
     PureImage tileImage;
     tileImage = GetTileImageUsingHttp(url);
     if (tileImage == null)
         tileImage = TileImageProxy.FromArray(GetBlankImage());

     return tileImage;
Jun 26, 2013 at 2:30 PM
you can set MaxZoom/MinZoom in your custom provider constructor, but even without limits set in provider, map settings itself doesn't allow that, works fine in other providers too