User Tools

Site Tools


map_suite_desktop_for_wpf_how_to_use_googlemaps

How to Use Google Maps in Map Suite Desktop (WPF) Edition

This guide helps you to create a google maps key and apply it in Map Suite.

Google offers two types of API plans. One is Standard Google Static Maps API, the other one is Google Maps APIs Premium Plan License. Each of them have two usages to make the https requests. This article will mainly cover Google Static Maps API.

Plan Options

standard google static maps api: you can either use API key or use API key and Signature to make the https requests.
google maps apis premium plan license: you can either use API key and Signature or ClientId and Signature to make the https requests.

How to Get API Key ( Notice: This key is only for developing/testing purpose. )

  1. Login your Google account. ( Note: If you do not have one, create one then login. )
  2. Create or select the project that will be using the API.
  3. Search for “Google Static Maps” and enable the API.
  4. Go to Credentials page, click create a credential, and select API key. ( Note: if you have an existing unrestricted API key, or a key with browser restrictions, you may use that key. )
  5. Select Restrict key and restrict your API key ( Optional )

Read more details about how to get a key.

How to use API key to test.

You can read more about how to get ClientId and PrivateKey or how to get Signature.

How to Use Google Maps Key in Map Suite Desktop Edition

The GoogleMapsOverlay will work after assigning your Google Maps ClientId and PrivateKey to the properties GoogleMapsOverlay.ClientId and GoogleMapsOverlay.PrivateKey. Here below is how to do that in a sample.

  1. Download Sample Source Code and open it in Visual Studio.
  2. Open MainWindow.xaml.cs and replace the values in the appropriate fields. ( see the code sample below )
  3. Restore NuGet Packages, build and run the sample.

Code Usage

  // Create a GoogleMapsOverlay and add it to wpfMap1
  GoogleMapsOverlay googleMapsOverlay = new GoogleMapsOverlay();
  googleMapsOverlay.MapType = GoogleMapsMapType.Satellite;
  googleMapsOverlay.ClientId = "Place Google Maps ClientId Here";
  googleMapsOverlay.PrivateKey = "Place Google Maps PrivateKey Here";
  wpfMap1.Overlays.Add(googleMapsOverlay); 


map_suite_desktop_for_wpf_how_to_use_googlemaps.txt · Last modified: 2018/03/30 21:30 by cloudhu