Google logo

Google Maps API v3 for GEEΒΆ


The Google Maps JavaScript API V3 is bundled with Google Earth Enterprise (GEE) Server and, for offline use, with Portable Server. As of November 2015, Google Maps JavaScript API v3.20 is bundled with GEE v5.1.2, but the API is updated periodically to align with the Release version.

The bundled offline Google Maps JavaScript API is the same core JavaScript V3 API supporting:

  • Events: Listening to click, mouseover
  • Controls: Built-in zoom, pan, scale + custom controls
  • Overlays: Symbols, markers, polylines

However there are some differences:

  • Method of invoking the API from a GEE or Portable Server to load in a web page.
  • geeCreateFusionMap is a factory used to create instances of the google.maps.Map class.
  • No support for objects that require access to online Google services:
    • Geocoding (google.maps.Geocoder)
    • Directions (google.maps.Directions)
    • StreetView (google.maps.StreetViewPanorama)
    • Traffic (google.maps.TrafficLayer)
    • Places API, Distance Matrix, Wikipedia, Panaramio, Weather layer, etc.

Using the Fusion Maps API

The Fusion Maps API is used to create and interact with map layers created in Google Earth Enterprise. The API is based on the Google Maps API but includes geeCreateFusionMap, which makes it easier to interact with map layers generated by Google Earth Enterprise. Essentially, geeCreateFusionMap is a factory used to create instances of the google.maps.Map class in which the GEE-specific configuration options can be added as Method extensions.

The following code snippet is a Hello World example of using geeCreateFusionMap to load a map:

      <meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
      <style type="text/css">
         html { height: 100% }
         body { height: 100%; margin: 0px; padding: 0px }
         #map_canvas { height: 100% }
      <title>Hello World - GEE 2D Map Example</title>

      <!-- Start by defining GEE_BASE_URL. -->
      <script type="text/javascript">
         var GEE_BASE_URL = window.location.protocol + '//' +;

      <!-- Include the provided Maps API v3 files.  Located in /opt/google/gehttpd/htdocs/maps/api/ -->
         <script type="text/javascript" src="/maps/api/bootstrap.js"></script>
         <script type="text/javascript"

         <!-- geeServerDefs must be defined with the following script; insert name of your published 2D database -->
         <script type="text/javascript" src="/YourPublishedDatabase/query?request=Json&var=geeServerDefs"></script>

         <script type="text/javascript">
            function initialize() {
               var myOptions = {
                  center: new google.maps.LatLng(-34.397, 150.644), zoom: 8
            var geemap = new geeCreateFusionMap("map_canvas", geeServerDefs, myOptions);

      <body onload="initialize()">
         <!-- Be sure there is an element on the page with the id you specified above (map_canvas in this case). -->
         <div id="map_canvas" style="width:100%; height:100%"></div>

Factory geeCreateFusionMap

Use of the factory geeCreateFusionMap is distinct from the standard Google Maps JavaScript API usage in the following ways:

  • Instantiate geeCreateFusionMap in order to create a Fusion map. This is a factory for an extended version of the Maps API v3 google.maps.Map class, and the other methods are the extensions to that class.
  • Use geeCreateFusionMap class instead of google.maps.Map to create applications that use layers from GME or GEE.
  • geeCreateFusionMap(container, opts?) creates a new map inside the given HTML container, typically a DIV element. Options are the same as those of google.maps.Map
  • If a map type is passed into the options, GEE Server will override these if an imagery layer is included in the Fusion Maps Database.
  • The path and location of the new map is serverURL/default_map, for example, http://my_host_name/default_map.

Factory geeCreateFusionMap Description

The Factory and Method extensions are described in the following tables.


Factoryclass Description
geeCreateFusionMap(container, opts?) Creates a new Fusion map inside of the given HTML container, which is typically a DIV element. The options are the same as the options for google.maps.Map. However, if a map type is passed in to the options, the Fusion maps server will override these if an imagery layer is included in the Fusion Maps Database. After this constructor is invoked, the setCenter() method should be called before any methods that display Fusion layers on top of the map.

Method extensions

geeCreateFusionMap Method extensions are extensions of the Google Maps API v3 google.maps.Map class.

Method extensions Return Value Description
showInitialFusionLayers() None Show all layers that are enabled by default. This method should only be invoked after the setCenter().
getFusionLayerCount() Number Returns the number of Fusion map layers. This does not include the base imagery layer, which is built as a custom map type and serves as the background of the map.
isFusionLayerVisible(index) Boolean Returns true if the layer is currently shown on the map and false if it is hidden.
showFusionLayer(index) None Shows a previously hidden Fusion map layer. This method should only be invoked after the setCenter() method has been called to initially draw the map.
hideFusionLayer(index) None Hides the specified Fusion map layer.
getFusionLayerName(index) String Returns the name of the specified layer.
getFusionLayerIcon(index) String Returns the URL of the icon associated with the specified layer.


Several examples that illustrate how to use the Fusion Maps API are installed by default. You can find these examples in:


The following files are used by default for a published database. For example, when serving, this code is used to render the page.

  • maps_local.html
  • maps_google.html

The following files provide basic examples of initializing a Fusion Map. You can use them as templates but you will need to edit them with the target path of a published 2D database to correctly initialize a map in the browser.

  • example_google.html
  • example_local.html

KML Support

The KMLLayer object in the Google Maps JavaScript API is unavailable in GEE since KML rendering is performed server-side and requires a connection to As a workaround, you can overlay KML data on your 2D Map using the GeoXml parser extension for Google Maps.

The following steps are needed to utilize the GeoXml library with 2D maps hosted on a Google Earth Enterprise Server:

  1. Download the GeoXml library to your GEE Server. geoxmlfull_v3.js is the main file to download.

  2. Store the GeoXml library in the GEE Server Apache Document root. Default location is /opt/google/gehttpd/htdocs/js

  3. Load the GeoXml library in your GEE 2D Map HTML file:

    <script type="text/javascript" src="/js/geoxmlfull_v3.js"></script>

  4. Store the target KML file in the GEE Server Apache Document root.

  5. Create a GeoXml object in the GEE 2D Map HTML file to load your KML file. Refer to GeoXml-specific methods and options.

See GeoXml samples.


  • Performance may degrade with large KML files.
  • GeoXml is an open-source package, not supported by Google.