ThinkGeo.com    |     Documentation    |     Premium Support

Choosing Language for Google Maps Layer

Hello,

we want to include a google maps layer in our map. Doing so with GoogleMapsOverlay shows the map localized in English language. That’s perfect for our international customers, but as we are a German based company and the main part of our customers are in German speaking countries, we’d like to have the Google maps localized in German as can be seen on maps.google.com/.de from a German located browser.
I haven’t found any hint where you can specify the language code on a GoogleMapsOverlay nor does explicit setting of thread culture help.

Second topic: is there support for HTTPS connection to Google?

Regards,
Markus

Hi Markus_Meyer,

The language option and “Https” option can be supported by “GoogleMapsOverlay”, you can implement them with following steps:

  1.   Language supporting option:
    

You can add a “SendingWebRequest” event:
GoogleMapsOverlay overlay = new GoogleMapsOverlay();
overlay.SendingWebRequest += Overlay_SendingWebRequest;
private void Overlay_SendingWebRequest(object sender, SendingWebRequestEventArgs e)
{
string absolutePath = e.WebRequest.RequestUri.AbsoluteUri;
e.WebRequest = HttpWebRequest.Create(String.Format(CultureInfo.InvariantCulture, “{0}&language={1}”, e.WebRequest.RequestUri.AbsoluteUri, “en”));
}

  1. Https supporting option:
    private void Overlay_SendingWebRequest(object sender, SendingWebRequestEventArgs e)
    {
    string absolutePath = e.WebRequest.RequestUri.AbsoluteUri;
    string newPath = String.Format(CultureInfo.InvariantCulture, “https://…{0}…”, …);
    e.WebRequest = HttpWebRequest.Create(String.Format(CultureInfo.InvariantCulture, “{0}&language={1}”, newPath, “en”));
    }

Thanks,

Thank you, requesting German tiles works, but it required the additional steps to first strip the signature and then resign the URL with the language parameter included.
Would be nice if you could include a language property in the future versions to avoid to be dependent on such workarounds.

Hi Markus_Meyer,

Thank you for your suggestion, the “Language” property has been appended into “GoogleMapsOverlay” and “GoogleMapsLayer”. You can get the latest version 9.0.408.0 or later, please have a try.

Thanks,

Casper. Lee