Skip to content
Snippets Groups Projects
Commit 72443121 authored by Brandon Bergren's avatar Brandon Bergren
Browse files

Remove GMAP-ARRAY-DICTIONARY.txt, it's replaced by the advanced_help page I wrote yesterday.

parent e4c9e0fe
No related branches found
No related tags found
No related merge requests found
GMAP-ARRAY-DICTIONARY.txt
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.
Example:
array(array(43.19, -104.06), array(46.01, -96.76))
Notes:
Setting extent will cause the map to disregard latitude, longitude, and zoom.
The actual map extent may vary slightly from the requested extent due to the
tiled zoom level based nature of Google Maps.
Attribute:
maxzoom
Values:
0-17 (Integer)
Description:
Sets the maximum level of zoom the 'autozoom' behavior flag will zoom to.
Useful to prevent single-marker maps from zooming in too far.
Example:
7
Attribute:
maptype
Values:
"Map", "Satellite", "Hybrid", "Terrain", ... (String)
Description:
Initial baselayer of map. The set of allowable baselayers can be extended,
see the gmap_extrabaselayers in the gmap_addons project for examples of how to
add additional baselayers.
Example:
"Map"
Notes:
The most common values are "Map" and "Hybrid". Addon modules that add additional
baselayers must use identfiers that won't conflict with other modules. (The
four "core" maptypes are poorly named due to legacy macros.)
Attribute:
controltype
Values:
"None", "Micro", "Small", "Large" (String)
Description:
Set the pan/zoom control type.
Example:
"Small"
Notes:
"Micro" corresponds to GSmallZoomControl, which only provides zoom control.
Attribute:
align
Values:
"Right", "Left", "Center" (String)
Description:
Sets the css alignment of the map div, using classes provided by gmap.css.
Example:
"Center"
Notes:
The limited flexibility of align is a holdover from the early days. If you
need to position a map div more accurately, consider using a mapid and targeting
the div yourself with css.
Attribute:
mtc
Values:
"none", "standard", "hier", "menu" (String)
Description:
The "map type control" widget used to select different baselayers.
Example:
"standard"
Notes:
"standard" -- buttons ('GMapTypeControl' widget)
"hier" -- buttons + dropdown menu ('GHierarchicalMapTypeControl' widget)
"menu" -- dropdown menu ('GMenuMapTypeControl' widget)
Attribute:
baselayers
Values:
array(string, ...)
Description:
Enabled baselayers.
Example:
array("Map", "Satellite", "Hybrid", "Terrain")
Notes:
The "traditional" set of baselayers is [Map, Satellite, Hybrid].
Other modules, such as gmap_extrabaselayers (from gmap_addons) may provide
additional possibilities.
The example shows the four "core" baselayers.
Attribute:
styles
Values:
array(string => array(...), ...)
Description:
An array of style names and definitions.
Example:
array(
'line_default' => array('0000ff',5,45,'',0,0),
'poly_default' => array('000000',3,25,'ff0000',45),
'green' => array('00ff00', 5, 100)
)
Notes:
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.
Attribute: points
Values: array(array(lat1, lon1), array(lat2, lon2), ... , array(latN, lonN))
Description: an array of points defining the shape
Example: array(array(44.205835001, -70.3674316406), array(44.3159879052, -68.6096191406))
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
);
?>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment