ThinkGeo.com    |     Documentation    |     Premium Support

GoogleMapsLayer - 1024 tile size + zoomlevelset02 leads to wrong projection

I have the following bug:

Google Maps is not correctly shown under some circumstances. It’s reproducable in a stand-alone demo:

string client = "XXX";
string privateKey = "XXX";
var googleOverlay = new LayerOverlay();

var googleLayer = new GoogleMapsLayer(null, client, privateKey)
{
    //ProjectedTileCache = null,
    TileWidth = 1024,
    TileHeight = 1024,
    TileMode = GoogleMapsTileMode.MultiTile,
    IsGrayscale = true,    
    PictureFormat = GoogleMapsPictureFormat.Jpeg,                             
    // WebProxy = new WebProxy(new Uri("http://localhost:8888"), false, null),
};

googleOverlay.Layers.Add(googleLayer);

MapControl.Overlays.Add(googleOverlay);
MapControl.ZoomLevelSet = new GoogleMapsZoomLevelSet();                   
MapControl.ZoomToScale(MapControl.ZoomLevelSet.ZoomLevel02.Scale);

If the TileWidth and TileHeight is set to 256, then no problem occurs.
But I have chosen the larger tile sizes to have less Google Logos.
With any other zoom level no problem occurs as well.

How can I work around this problem? I tried deactivating the zoom level, which would be acceptable. But I can’t figure out how.

MapControl.ZoomLevelSet.ZoomLevel02.IsActive = false;
MapControl.ZoomToScale(MapControl.ZoomLevelSet.ZoomLevel03.Scale);

Depsite setting the zoom level inactive I can go to the zoom level 02 using the mousewheel.

Hi Andreas,

If you want to skip the level 2, you can try the code as below:

Collection levels = Map1.ZoomLevelSet.GetZoomLevels();

        int i = 0;

        foreach (ZoomLevel level in levels)
        {
            i++;
            if (i == 2) continue;

            Map1.ZoomLevelSet.CustomZoomLevels.Add(level);
        }

It build custom zoomlevels and ignore the level 2.

Wish that’s helpful.

Regards,

Don

OK, I had to remove ZoomLevel01 and ZoomLevel 02.

ZoomLevel03 still allows to see the entire world map, so that’s OK.

Hi Andreas,

You can avoid any level you don’t want to show.

It’s not allowed to remove the logo from Google if choose smaller tile size, but if it works well now it should be a good workaround.

Any question please let us know.

Regards,

Don