My favorites | English | Sign in

Google Maps API Premier

Google Maps API Premier Developer's Guide

The Google Maps API lets you add easy-to-use interactive maps to your public website, enhancing your customers' experience by helping them find exactly what they need from your organization. That's why it's the most popular mapping API in the world. When Google Maps plays an important role on your public website, or is incorporated in an internal application for your employees, organizations need an enterprise-class application that handles high volumes and provides necessary support.

  1. Why Google Maps API Premier?
  2. Specifying a Client ID
  3. Tracking Usage with the sensor Parameter
  4. Accessing and Loading the API
    1. Loading the JavaScript API Using the client Parameter
    2. Loading the JavaScript API Using the Common Loader
    3. Loading the Google Maps API for Flash
  5. Using Maps API Services
    1. Static Maps API
    2. Geocoding Service
  6. Determining Application Usage
  7. Support

Why Google Maps API Premier?

Google Maps API Premier provides Enterprise-ready application support for your mapping application needs. Google Maps API Premier uses the same code base as the standard Google Maps API, but provides the following additional features and benefits:

  • A robust Service Level Agreement (SLA)
  • Customer support
  • Increased geocoding limits
  • Commercial-grade terms and conditions
  • Intranet application support within the enterprise
  • Access to the API via a secure https connection

Google Maps API Premier requires registration of your website to access these additional features. For more information, contact us.

This documentation discusses use cases and coding issues particular to the Google Maps API Premier product. For full documentation on all common code, use this guide in consultation with the existing Google Maps API Documentation.

Specifying a Client ID

To access the special features of Google Maps API Premier, you must provide a client ID when accessing any of the Premier API libraries or services. When registering for Google Maps API Premier, you will receive this client ID from Google Enterprise Support. All client IDs begin with a gme- prefix.

Your client ID may be tied to one or more website domains. For existing customers, any domain which you previously tied to your Premier account through issuance of an API key will have been automatically added to your account. If you wish to obtain a list of your currently enabled domains, or enable additional domains for your client ID, please contact Google Enterprise Support. There is no limit to the number of domains that can be enabled for your client ID.

Note: this client ID is not a key. It will only work from domains which you authorize so you don't need to worry about keeping it secret. Users of Google Maps API Premier no longer need to register or provide an API key when using the Maps API or one of its services.

Tracking Usage with the sensor Parameter

Use of the Google Maps API(s) now requires that you indicate whether your application is using a sensor (such as a GPS locator) to determine the user's location in any Maps API library or service requests. This is especially important for mobile devices. If your Google Maps API application uses any form of sensor to determine the location of the device accessing your application, you must declare this with a sensor parameter value of true.

Note that even if your application does not use a location sensor, you still must set the sensor parameter (in this case to false).

Accessing and Loading the API

Loading a Maps API library or service as a Premier application requires specification of the Client ID within a client parameter. How you specify this value depends on the library or service you utilize.

Loading the JavaScript API Using the client Parameter

To load the Google Maps JavaScript API using your Google Maps API Premier client ID, append an additional client parameter onto the URL used to retrieve the JavaScript library:

<script src="http://maps.google.com/maps?file=api&v=2&client=gme-yourclientid&sensor=false" type="text/javascript"></script>

Note that you do not need to provide an API key in this URL, though you do need to provide a sensor parameter.

Google Maps API Premier customers can also access the Google Maps JavaScript API over https. In order to use the Google Maps JavaScript API over https your client ID must first be enabled for https access by Google Enterprise Support. If your client has not been enabled for https, requests will instead be redirected to HTTP.

To load the Google Maps JavaScript API over https, you use the HTTPS protocol and load the API from the following URL:

<script src="https://maps-api-ssl.google.com/maps?file=api&v=2&client=gme-yourclientid&sensor=false"
type="text/javascript"></script>

Loading the JavaScript API Using the Common Loader

The Google Maps JavaScript API is now fully integrated with the Google AJAX APIs as documented at http://code.google.com/apis/maps/documentation/#AJAX_Loader.

It is not necessary to provide an API key when loading the common loader if you wish to load the Google Maps JavaScript API with your Google Maps API Premier client ID:

<script type="text/javascript" src="http://www.google.com/jsapi"></script>

When loading the Google Maps JavaScript API using the common loader, provide your client ID within the other_params option:

google.load("maps","2", {"other_params":"client=gme-yourclientid&sensor=false"}); 

Google Maps API Premier customers can also load the Google Maps JavaScript API over https. In order to use the Google Maps JavaScript API over https your client ID must first be enabled for HTTPS access by Google Enterprise Support.

To load the Google Maps JavaScript API over https using the Google AJAX API Loader, first load the common loader over https:

<script type="text/javascript" src="https://www.google.com/jsapi"></script>

Once loaded, you can then load the Google Maps JavaScript API using google.load() as shown above.

As with requests made for the Google Maps JavaScript API over https, loading the Maps API using the Common Loader with a client ID that has not been enabled for https will be redirected to HTTP.

Loading the Google Maps API for Flash

Your Google Maps API Premier client ID also allows you to access the Google Maps API for Flash as an Enterprise application. Full documentation for the Google Maps API for Flash is available at http://code.google.com/apis/maps/documentation/flash/. As with the JavaScript API, you will need to pass client and sensor parameters when accessing the API, though you will not need an API key.

Note: The Google Maps for Flash API removed the need to provide API keys for Premier customers starting with version 1.8b of the Flash SDK. Be sure you compile your application using that version or later to take advantage of keyless functionality. Existing applications will need to be re-compiled with this version to enable keyless support.

There are three ways to supply your Google Maps API Premier client ID when accessing the Google Maps API for Flash. Whichever you choose, we recommend that you supply both your client ID and the sensor parameter in the same manner:

  1. Supply your client ID and sensor parameter as attributes of the UI container object declared in your MXML:

    <maps:Map xmlns:maps="com.google.maps.*" id="map"
    mapevent_mapready="onMapReady(event)" width="100%" height="100%" 
    sensor="false" client="gme-yourclientid"/>
    

    This method is preferred if you are developing your application using FlexBuilder or the Flex framework.

  2. Supply your client ID and sensor parameter as attributes of the object and embed tags used to add your Flash application to a web page:

    <div id="map_canvas" name="map_canvas">
      <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
          codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0"
          width="800px"
          height="600px">
        <param name="movie" value="helloworld.swf">
        <param name="quality" value="high">
        <param name="flashVars" value="client=gme-yourclientid&sensor=false">
        <embed width="800px"
            height="600px"
            src="helloworld.swf"
            quality="high"
            flashVars="client=gme-yourclientid&sensor=false"
            pluginspage="http://www.macromedia.com/go/getflashplayer"
            type="application/x-shockwave-flash">
        </embed> 
      </object> 
    </div>
    
  3. Supply your client ID and sensor parameter as properties of your Map object directly within ActionScript code:

      var map:Map = new Map();
      map.sensor = false;
      map.client = "gme-yourclientid";
    

    This method is necessary if you are developing your application within Flash CS3.

The Google Maps API for Flash is not https-enabled at this time.

Using Maps API Services

Your Google Maps API Premier client ID not only allows you to access the JavaScript API with Enterprise support, but also any existing Google Maps API services. Using these services with a Premier license allows you increased access and support.

Static Maps API

The Google Static Maps API allows you to construct and retrieve map images using parameters passed through its URL service. Full documentation of the Google Static Maps V2 API is available at http://code.google.com/apis/maps/documentation/staticmaps/. Static Maps API requests using a Premier client ID have higher query limits.

The Google Static Maps V1 API at http://maps.google.com/staticmap has been deprecated. We encourage you to move your applications to the V2 API. Applications using the V1 API will continue to be supported in accordance with the Maps API deprecation policy.

To embed a map image in a webpage using your Google Maps API Premier client ID, append a client parameter containing your client ID to the Static Map URL, also passing a sensor parameter value.

http://maps.google.com/maps/api/staticmap?center=40.714728,-73.998672&zoom=12&size=400x400&client=gme-yourclientid&sensor=false 

Note that you do not need to pass an API key.

Google Maps API Premier customers can also make requests to the Static Maps API over https. In order to use the Static Maps API over https your client ID must first be enabled for HTTPS access by Google Enterprise Support.

To embed a map image into a page retrieved over a secure https connection, use the alternative hostname in your request URL as shown below:

https://maps-api-ssl.google.com/maps/api/staticmap?center=40.714728,-73.998672&zoom=12&size=400x400&client=gme-yourclientid&sensor=false

Note: Static Maps API Requests over https using a client ID that has not been enabled for https will be rejected with a Status 400 "Bad Request" error.

Geocoding Service

The Google Maps Geocoding service allows you to request latitude and longitude information for address queries. Full documentation of the Google HTTP Geocoder is available at http://code.google.com/apis/maps/documentation/services.html#Geocoding_Direct.

To request a geocode from the Google HTTP Geocoder using your Google Maps API Premier client ID, append a client parameter containing your client ID to the Geocoder URL.

http://maps.google.com/maps/geo?q=1600+Amphitheatre+Parkway,+Mountain+View,+CA&output=xml&client=gme-yourclientid&sensor=false

Note that you do not need to provide an API key in this URL, though you do need to provide a sensor parameter.

Google Maps API Premier customers can also make requests to the Geocoding Service over https. In order to use the Geocoding Service over https your client ID must first be enabled for HTTPS access by Google Enterprise Support.

To request a geocode using the Google HTTP Geocoder over https, use the alternative hostname in your request URL as shown below:

https://maps-api-ssl.google.com/maps/geo?q=1600+Amphitheatre+Parkway,+Mountain+View,+CA&output=xml&client=gme-yourclientid&sensor=false

Requests made to the Maps API Geocoding service over https using a client ID that has not been enabled for https will return a 610 (G_GEO_BAD_KEY) geocoder response. Requests made in excess of your daily and instantaneous throughput limits may return a 620 (G_GEO_TOO_MANY_QUERIES).

Determining Application Usage

Google Maps API Premier enables customers to determine and analyze the activity on your API application based on client ID. However, in some cases you may wish to provide a finer breakdown of usage across different applications using the same client ID. In those cases, you may provide an optional channel parameter when accessing any of the Premier API libraries or services. By specifying different channel values for different aspects of your application, you can determine precisely how your application is used.

This channel is a unique string which you define and will be logged when accessing the Google Maps API Premier services. Google will provide you usage statistics for your client ID broken down by your defined channels in your Enterprise support portal.

For example, your externally facing website may access the API using a channel set to customer while your internal marketing department may instead have a channel set to mkting. Your reports will break down usage by those channel values.

The channel parameter must be an ASCII alphanumeric string. Additionally, the period (.) and hyphen (-) values are allowed. Note: The channel value must be a static value assigned per application instance, and must not be generated dynamically. You may not use channel values to track individual users, for example.

The channel parameter is provided in the same manner as the client and sensor parameters within each Maps API or service. For example, if loading the Maps JavaScript API from http://maps.google.com or http://maps-api-ssl.google.com, append a channel parameter to the src URL of your script tag:

<script src="http://maps.google.com/maps?file=api&v=2&client=gme-yourclientid&sensor=false&channel=yourchannel" type="text/javascript"></script>

Support

Google Maps API Premier comes with dedicated Enterprise-level support. Once you obtain a Premier license, you'll receive contact information from a Google Maps API Enterprise Support representative.