Google Maps API Tutorial

© 2008, 2009 Mike Williams

Translate this page:


Using EInsert.groundOverlay

EInsert.groundOverlay() is a static method which creates an EInsert() object using parameters similar to those of GGroundOverlay(). I.e. it uses a GLatLngBounds to specify the corners of the region, instead of using a centre point and size.

Here's an example

In order to use EInsert.groundoverlay() you need to:

  1. Create a suitable image. Transparent PNG format is particularly suitable. Animated GIF format is not suitable.
  2. Include a copy of the "einsert.js" file. Please take your own local copy, don't hot link to my copy of the file.
  3. Create some EInsert objects using EInsert.groundoverlay().
  4. Use map.addOverlay() to add them to the map.

Create some EInsert objects using EInsert.groundoverlay()

      var insert = EInsert.groundOverlay("foo.png",new GLatLngBounds(sw,ne));
The parameters are:
  1. A string containing the URL of the image.
  2. A GLatLngBounds() specifying the bounds of the region.
  3. (Optional) zindex and pane control value.
    Use -1 if you want this EInsert to be placed below any polylines and GTileLayerOverlay()s.
    use 0 if you want this EInsert to be placed above any polylines and below any GTileLayerOverlay()s.
    Use 1 if you want this EInsert to be placed above any polylines and GTileLayerOverlay()s.
    Use other values to place one EInsert above or below another.
  4. (Optional) GProjection to be used for non-mercator map
  5. (Optional) Zoom level to be used for calculations if the GProjection doesn't have a zoom level 17.
For normal maps that use the Mercator projection, omit the last two parameters.
The number of zoom levels in a GProjection is not exposed, so if you are using a custom GProjection with fewer zoom levels, you need to tell me the highest zoom level that I can use for the calculations.

Note Don't write "new EInsert.groundOverlay(...)". EInsert.groundOverlay() is a static method, not a constructor.

The EInsert() created by EInsert.groundOverlay() supports all the usual EInsert() methods. See Using the EInsert extension

Back to Mike's Homepage
Up to the start of this tutorial