ThinkGeo.com    |     Documentation    |     Premium Support

Multiple google maps banner or logo on maps

Hi Team,
Multiple google banners are displayed on maps looks annoying to customers. Could you please guide me how to fix the issue.

Attached screen shot for reference:

Sample code here:

using (var googleOverlay = new GoogleMapsOverlay(Properties.Settings.Default.GoogleClientID, Properties.Settings.Default.GooglePrivateKey)
{
MapType = GoogleMapsMapType.Hybrid,
TileType = TileType.MultipleTile,
DrawingExceptionMode = DrawingExceptionMode.DrawException,
TransitionEffect = TransitionEffect.Stretch,
})
{
googleOverlay.TileCache = new FileBitmapTileCache(tileCacheFolder, “googleMap”);
googleOverlay.TileHeight = 512;
googleOverlay.TileWidth = 512;
googleOverlay.SendingWebRequest += googleOverlay_SendingWebRequest;
googleOverlay.DrawingException += (sender, e) => LogHost.Default.ErrorException(e.Exception.ToString(), e.Exception);
googleOverlay.DrawnException += (sender, e) => LogHost.Default.ErrorException(e.Exception.ToString(), e.Exception);
Map.Overlays.Add(BACKGROUND_OVERLAY, googleOverlay);
}

Below code is for cashing
public void SaveMapAsImage(BetterWpfMap map, string fileName, ProposalLayers pdfZone, Proposal proposal)
{
try
{
var engine = new MapEngine();
var tileCacheFolder = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData);
var googleLayer = new GoogleMapsLayer(tileCacheFolder, Properties.Settings.Default.GoogleClientID, Properties.Settings.Default.GooglePrivateKey)
{
MapType = GoogleMapsMapType.Hybrid,
DrawingExceptionMode = DrawingExceptionMode.DrawException
};
engine.DynamicLayers.Add(googleLayer);
try
{
using (var img = new Bitmap(1000, 700))
{
SaveMapAsImage(map, fileName, proposal, pdfZone, engine, img);
}
}
catch (Exception e)
{
LogHost.Default.ErrorException(e.ToString(), e);
}
}
catch (Exception e)
{
LogHost.Default.ErrorException(“Error generating map image.”, e);
}
}

Thanks,
Ravi

Hi Ravi,

Remove the logos is not allowed, but you can do some change to reduce the number of them.

  1. Try to use SingleTile mode.

  2. Increase the tile size, which can also reduce the logo number. You can view the limitation for tile size of Google here:
    https://developers.google.com/maps/documentation/static-maps/intro#Imagesizes

Wish that’s helpful.

Regards,

Ethan

Hi Ethan,

I tried changing width from 256256 to 20482047 but still see same number of banners on map.
Even tried 128128 but map is looking distorted and 40964096 is very slow.

When I changed to TileType to Single its application is hanging.
I have a valid Google client Id and Private key.

Issue can be reproduced with the below sample.Please go through below code sample and suggest me the workaround.

Thanks,
Ravi

Hi Ravi,

Thanks for your sample, please remove the client id and private key from it, or remove the download link.

Today our developer tried your sample but failed to render map after set the default tile size and set multiply tile mode.

We had removed the cache also, it still don’t shows anything.

So I think maybe we missed some point about your sample, could you please let us know your detail dll version and if we missed any step please let us know.

Regards,

Ethan

Hi Ethan,

We are using ThinkGeo version Daily Full Development 9.0.853.0

I also tried what you have suggested(Remove client Id, Private key and Cache). Refer to below method for changes but still I can see 3 google banners.

    private void CreateGoogleOverlay()
    {
        //var tileCacheFolder = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData);
        //tileCacheFolder += "\\ThinkGeo9Touch";

        const GoogleMapsMapType mapType = GoogleMapsMapType.Hybrid;

        //using (var googleOverlay = new GoogleMapsOverlay("gme-valmontindustries", "key")

            using (var googleOverlay = new GoogleMapsOverlay()
            {
                //MapType = GoogleMapsMapType.Hybrid,
                MapType = mapType,
                TileType = TileType.MultipleTile,
                DrawingExceptionMode = DrawingExceptionMode.DrawException,
                TransitionEffect = TransitionEffect.Stretch,
            })
        {
            //googleOverlay.TileCache = new FileBitmapTileCache(tileCacheFolder, "googleMap");
            //googleOverlay.TileHeight = 512;
            //googleOverlay.TileWidth = 512;
            //googleOverlay.SendingWebRequest += googleOverlay_SendingWebRequest;
            googleOverlay.DrawingException += (sender, e) => LogHost.Default.ErrorException(e.Exception.ToString(), e.Exception);
            googleOverlay.DrawnException += (sender, e) => LogHost.Default.ErrorException(e.Exception.ToString(), e.Exception);
            Map.Overlays.Add(BACKGROUND_OVERLAY, googleOverlay);
        }

    }

Just launching the application will display the map.No other steps are required to reproduce the issue.

Hi Patrick,

a. I means you should want to remove your download link, because it contains your client id and private key in your code. Here is a public forum and it will be visited by search engines also. So public your id and key here is unsafe. If you want to sent that to us for test, you can sent that by email or via our ticket system.

b. Even you set the tile size to 512 * 512, you cannot remove all the tile logo, when your map is bigger than the size. You can go on increase the tile size until the limitation from Google: https://developers.google.com/maps/documentation/static-maps/intro#Imagesizes

c. I am trying to reproduce your issue, but for your application we still cannot see the map, so we cannot reproduce the hanging of it.

d. Our developer will did further test about the single tile, if we found there is problem there we will fix that and let you know.

Regards,

Ethan

Hi Ethan,

Any update on the issue?

Thanks,
Ravi

Hi Ravi,

Just like item 3 in my last reply, we hadn’t reproduced the issue in our machine use your code and the target version.

Have you tried the sample in any other machine without the same network and still can reproduce this problem? Or do you think you can upgrade the dll version to our latest version, I guess that’s maybe related with environment or dll version.

Any further information about it please let us know.

Regards,

Ethan