This file defines the attributes available in GMap arrays. This is fairly similar to the GMAP-MACRO-DICTIONARY.txt, but distinct in that it addresses array keys and syntax specific to GMap arrays.
Defaults for map attributes can be set on the GMap settings page, located at admin/settings/gmap
----------------
BASIC ATTRIBUTES
----------------
The top level of a GMap array will look something like this:
<?php
$map = array(
'id' => // id attribute for the map
'width' => // map width in pixels or %
'height' => // map height in pixels
'latitude' => // map center latitude
'longitude' => // map center longitude
'zoom' => // zoom level
'maptype' => // baselayer type
'controltype' => // size of map controls
'behavior' => array(),// various map behavior flags
'markers' => array(), // array of points on the map
'shapes' => array(), // array of shapes to overlay on the map
);
?>
Attribute:
id
Values:
Identifier (String)
Description:
A unique identifier, used to distinguish a map from other maps on the page, and as a key to tie controls to a map.
Example:
"mymap"
Notes:
Assign this if you are planning on using external controls with a map.
One will be automatically assigned if you don't specify an id.
Attribute:
width
Values:
CSS Dimension (String)
Description:
Width of map div, in valid css dimensions (generally pixels or percent).
Example:
"100%"
Attribute:
height
Values:
CSS Dimension (String)
Description:
Height of map div, in valid css dimensions (generally pixels).
Example:
"400px"
Notes:
Using a percentage for height will most likely lead to a buggy map. Google's javascript
must be able to determine the actual height of the map div for proper operation.
Attribute:
latitude
Values:
Latitude of map center in degrees decimal format. (Float)
Description:
Map center point latitude, as a signed float.
Example:
39.36827914916013
Notes:
Cast to float if you are unsure what type your latitude variable is; some parts of
Google Maps do not operate correctly if latitude is passed as a string.
See "extent" if you wish to provide a bounding rectangle instead.
Attribute:
longitude
Values:
Longitude of map center in degrees decimal format. (Float)
Description:
Map center point longitude, as a signed float.
Example:
-81.5625
Notes:
Cast to float if you are unsure what type your latitude variable is; some parts of
Google Maps do not operate correctly if latitude is passed as a string.
See "extent" if you wish to provide a bounding rectangle instead.
Attribute:
zoom
Values:
0-17 (Integer)
Description:
Initial map zoom level. (This may be modified after map load by the user / autozoom / etc.)
Example:
7
Notes:
0 is the furthest out zoom level, 17 is the closest up zoom level (but is subject to change.)
Some areas do not have satellite data all the way to 17, you may want to stay zoomed out a few clicks.
See "extent" if you wish to provide a bounding rectangle instead.
Attribute:
extent
Values:
array(array(float, float), array(float, float))
Description:
Initial bounding box for map. The first inner array is the southwest corner,
the second inner array is the northeast corner.
All units are degrees decimal.
Make sure to cast coordinate components to float as needed.
Currently, 'line_default' and 'poly_default' are predefined, and apply to lines and
filled polygons that do not have style information assigned.
You can override these two defaults on the map level if you wish.
See "Style definitions" below for more information on styles.
Attribute:
behavior
Values:
array(string, ...)
Description:
Map behavior flags.
Any that aren't set on the map level will be inherited from the defaults.
Notes:
There are several behavior flags recognized by gmap.module, and other modules
may choose to add their own behavior flags as well.
All behavior flags recognized are documented on admin/settings/gmap.
Core behavior flags:
locpick -- Puts the map into "locpick" mode, which is used to choose a coordinate using the map.
nodrag -- Disables map dragging. Also disables keyboard shortcuts.
nokeyboard -- Disables the keyboard handler (arrow keys, etc.)
nomousezoom -- Disables the ability to zoom with the mouse wheel (Needs a third party file)
autozoom -- Enables automatic map bounds calculation, based on the markers added to the map.
dynmarkers -- Ensures the marker system is loaded. Use this if you will be dynamically adding markers
to an empty map.
overview -- Enables the miniature overview map in the bottom right corner.
collapsehack -- Attempts to work around a resize bug when placing maps inside collapsible fieldsets.
This does not work in all themes.
scale -- Adds a map scale legend to the map.
fatmarkers -- If enabled on a View, this will cause the gmap_views code to
serialize the views fields and pass it through the map object. This is useful
if you wish to use custom marker handling code. Since you can't currently
use map arrays with GMap Views (only macros), there's usually no point in setting it.
--------
OVERLAYS
--------
There are three types of overlays you can place on a map: markers, shapes, and feeds.
Each of these classes is represented by a sub-array in the GMap array.
Attribute:
markers
Values:
array(array(...), ...)
Description:
An array of marker arrays to place on the map.
------------------------
OVERLAYS : MARKER ARRAYS
------------------------
<?php
$marker = array(
'options' => array(),
'text' => 'popup text',
'longitude' => 0.000,
'latitude' => 0.000,
'markername' =>
'offset' => 0,
);
?>
Attribute:
latitude
Values:
Latitude of point in degrees decimal format. (Float)
Description:
Marker latitude, as a signed float
Example:
39.36827914916013
Notes:
Cast to float if you are unsure what type your latitude variable is; some parts of
Google Maps do not operate correctly if latitude is passed as a string.
Attribute:
longitude
Values:
Longitude of point in degrees decimal format. (Float)
Description:
Marker longitude, as a signed float.
Example:
-81.5625
Notes:
Cast to float if you are unsure what type your latitude variable is; some parts of
Google Maps do not operate correctly if latitude is passed as a string.
Attribute:
markername
Values:
The name of the icon set to use (String)
Description:
Marker icons are located in the GMap module's 'markers' directory.
GMap reads the .ini files to find available markers.
Example:
"Light Blue"
Notes:
Some marker sets
sequential markers are available; for example, if the markername is set to "number", then the icons in the marker directory named 'number1.png', 'number2.png' etc. will be used. If these don't exist 'number.png' would be used. If that doesn't exist then the default marker will be used.
Attribute: text
Values: "map bubble text"
Description: text and/or HTML to be displayed in the map bubble when the marker is clicked
Example: "Point A"
Notes: @@@ Bdragon mentioned an "array tabs trick"??
Attribute: shapes
Values: array()
Description: an array of shapes to place on the map
A "line" or "polygon" shape will be described by an array that looks like this:
<?php
$shape = array(
'type' => "polygon",
'points' => array(
array(0.000, 0.000),
array(0.000, 0.000),
array(0.000, 0.000),
),
'style' => array("ff0000", 5, 80, "00ff00", 60),
);
?>
Attribute: type
Values: "line", "polygon", "circle", "rpolygon"
Description: the type of shape to draw
Example: "line"
Notes: "line" is drawn as a GPolyline.
"polygon" is drawn as a GPolygon.
"circle" and "rpolygon" (regular polygon) are special cases of "polygon"; points are calculated on the fly. The array defining circles and regular polygons looks different from the arrays defining lines and polygons; see below.
Notes: Each point itself is an array with two elements (latitude, longitude). The different shapes have different requirements with respect to points.
"line" must have at least two points. It is best to break up long lines into shorter segments, because long lines can be buggy--sometimes beginning and ending points are switched.
"polygon" should have at least three points; the first and last points should have the same coordinates.
Attribute: style
Values: array(stroke color, stroke weight, stroke opacity, fill color, fill opacity)
Description: a "style array"
Example: array("ff0000", 5, 80, "00ff00", 60)
Notes: The elements of this array MUST be in the specified order.
Stroke and fill colors should be hex color codes (without the leading "#"); Google Maps does not accept named colors.
The stroke weight is the width of the line or polygon border in pixels.
Stroke and fill opacities should be a percentage between 0 and 100.
Fill color and fill opacity are not used for type "line".
If shapes of type "line" don't have styles defined, the 'line_default' style will be used; shapes of type "polygon", "circle", and "rpolygon" will use 'poly_defalt'.
In previous versions of GMap, opacity was specified as a number between 0 and 1; it is now a number between 0 and 100.
On backwards compatibility: there were originally more style options, but they were dependant on xmaps; xmaps is no longer compatible with Google Maps, so these options are now ignored. They are: 'pattern', 'text', 'fillcolor', 'fillopacity'; all except for 'pattern' are now available with different syntax.
Circles and regular polygons are special cases of "polygon" and have significantly different shape arrays:
<?php
$shape1 = array(
'type' => 'circle',
'center' => array(0.000, 0.000), // center coordinate of the circle
'radius' => 100, // radius of the circle in kilmeters
'style' => array(), // uses 'poly_default' if not defined
);
$shape2 = array(
'type' => 'rpolygon',
'center' => array(0.000, 0.000), // center coordinate of the circle
'numpoints' => 4, // number of vertices the polygon should have
'point2' => array(0.000, 0.000), // one vertice of the polygon
'style' => array(), // uses 'poly_default' if not defined