A GMap array is used to define and render a map inside PHP code. This is useful for things like creating a map based on a database query, or doing things that you can't do with a macro.

Defaults for map attributes can be set on the GMap settings page.

TOP LEVEL ATTRIBUTES

These are all of the (by default) recognized keys for a map array. You usually will only use a subset of them.

  $map = array(
    'id' =>                  // "Map ID" -- used to associate a map with other controls.
    'width' =>               // Map width as a CSS dimension.
    'height' =>              // Map height as a CSS dimension (usually px).
    'latitude' =>            // Map center latitude.
    'longitude' =>           // Map center longitude.
    'zoom' =>                // Zoom level.
    'maxzoom' =>             // Maximum zoom level for autozoom.
    'extent =>               // Map bounds.
    'maptype' =>             // Initial baselayer type.
    'controltype' =>         // Size of map controls.
    'align' =>               // CSS alignment for map div.
    'mtc' =>                 // Map type control.
    'baselayers' => array(), // Enabled map baselayers.
    'styles' => array(),     // Shape style definitions.
    'behavior' => array(),   // Various map behavior flags.
    'rmtcallback' =>         // Remote callback for ahah info windows.
    'iwq' =>                 // Info window DOM query.
    'markers' => array(),    // Array of markers to place on the map.
    'shapes' => array(),     // Array of shapes to place on the map.
  );

Here is a description of the top level keys of the map array.

OVERLAYS

There are three types of overlays you can place on a map by default: markers, shapes, and feeds. Each of these classes is represented by a sub-array in the GMap array. Addon modules can add more types of overlays.

MARKERS

Markers are point features on a map. They are placed somewhere on the globe and can optionally be programmed to show an information window when clicked.

Any additional keys / values you put in a marker array will be passed to the javascript side automatically. This is very useful when writing custom code.

  $marker = array(
    'latitude' => 0.000,            // Marker latitude.
    'longitude' => 0.000,           // Marker longitude.
    'markername' => 'smileyface',   // Name of marker set to use.
    'offset' => 0,                  // Offset in marker set.
    'text' => 'popup text',         // GInfoWindow contents.
    'tabs' => array(),              // Tabbed GInfoWindow contents.
    'link' => 'http://google.com',  // Use marker as hyperlink.
    'rmt' => '',                    // Argument to pass for rmt
    'iwq' => '',                    // Info window query
    'iwo' => 0,                     // Info window offset
    'opts' => array(),              // Use custom GMarkerOptions.
    'options' => array(),           // Misc. behavior modifications.
  );

Here is a description of the keys of a marker array.

SHAPES

Shapes are the non point features on the map.

  $shape = array(
    'type' => '',
    'points' => array(),
    'center' => array(0,0),
    'radius' => 0,
    'point2' => array(0,0),
    'numpoints' => 10,
    'style' => array(),
  );

USING A MAP ARRAY

$map = array(...); // Set up your map array.
$element = array( // GMap in Drupal 7 uses drupal_render().
  '#type' => 'gmap',
  '#gmap_settings' => $map,
);
$output = drupal_render($element);