 guide to the map array 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  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 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 width values css dimension string description width of map div in valid css dimensions generally pixels or percent example 100  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 latitude values latitude of map center in degrees decimal format float description map center point latitude as a signed float example 3936827914916013 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 longitude values longitude of map center in degrees decimal format float description map center point longitude as a signed float example 815625 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 zoom values 017 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 maxzoom values 017 integer description sets the maximum level of zoom the autozoom behavior flag will zoom to useful to prevent singlemarker maps from zooming in too far example 7 notes  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 4319 10406 array 4601 9676 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 maptype values map satellite hybrid terrain string description initial baselayer of map the set of allowable baselayers can be extended see the gmapextrabaselayers in the gmapaddons 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  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 align values right left center string description sets the css alignment of the map div using classes provided by gmapcss 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 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  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 gmapextrabaselayers from gmapaddons may provide additional possibilities the example shows the four core baselayers styles values array string array description an array of style names and definitions example array linedefault array 0000ff 54500 polydefault array 000000325 ff000045 green array 00ff00 5 100 notes currently linedefault and polydefault 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 the shape style definition for more information on styles behavior values array string description map behavior flags any that aren t set on the map level will be inherited from the defaults example array autozoom overview notes there are several behavior flags recognized by gmapmodule and other modules may choose to add their own behavior flags as well all behavior flags recognized are documented on the gmap settings page  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 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 gmapviews 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 rmtcallback values base url of callback path string description this specifies the location that gmap needs to call the drupal site back at to retrieve the contents of an ahah info window example checkurl url my callback notes each marker can have a rmt parameter that determines what is appended to the path when making the callback this should be used to pass a unique identifier to your callback so you can retrieve the correct data markers values array array description an array of marker arrays to place on the map example array array options array text start longitude 12196 latitude 5813 markername route offset 0 array options array text finish longitude 12196 latitude 58523 markername route offset 1 notes there are three types of overlays you can place on a map markers shapes and feeds each of these classes is represented by a subarray in the gmap array this is not the only way to put markers on the map it is however the easiest way the markers specified here are loaded through the static marker loader you can also set arbitrary keys in the array they will be passed to the javascript side automatically shapes values array array description an array of shapes to place on the map the format of the shape arrays depends on the type example array array type line points array array 0000 0000 first point array 0000 0000 second point array 0000 0000 third point style array 00ff00 5 80 array type polygon points array array 0000 0000 first point array 0000 0000 second point array 0000 0000 third point style array ff0000 5 80 00ff00 60 array type circle center array 0000 0000 center coordinate of the circle radius 100 radius of the circle in kilometers style array style to use array type rpolygon center array 0000 0000 center coordinate of the regular polygon numpoints 4 number of vertices the polygon should have point2 array 0000 0000 one of the vertex coordinates style array style to use array type encodedline points icx ffigvot csnb vo g adqnbp chb a series of points encoded levels bbbbb zoom level for each point encoded numlevels 18 derived from the encoding algorithm zoomfactor 2 derived from the encoding algorithm style array array type encodedpolygon polylines array array points s r fnwcvo zb qha fa e ac rn levels bbbb numlevels 18 zoomfactor 2 style array notes for both encodedline and encodedpolyline  the points levels numlevels and zoomfactor should be generated using the gmappolyutilpolyline  function in gmappolyutilinc  to use this pass an array of points into the function points array array 4190625 8767634 array 4191226 8765643 array 4191021 8765059 array 4190753 8764956 gmapencoding gmappolyutilpolyline points results in array points ayw fbhcvoqd m bxkoc vome levels pgfp numlevels 18 zoomfactor 2  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 subarray 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  0000 marker latitude  longitude  0000 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 googlecom use marker as hyperlink  rmt  argument to pass for rmt  opts  array use custom gmarkeroptions  options  array misc behavior modifications here is a description of the keys of a marker array latitude values latitude of point in degrees decimal format float description marker latitude as a signed float example 3936827914916013 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 longitude values longitude of point in degrees decimal format float description marker longitude as a signed float example 815625 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 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 markers have multiple icons use offset to choose which one to show offset values the index of the marker to use integer description for markernames with multiple icons you can choose which one to use example 0 notes the code will automatically wrap around if you simply increment offset every marker you do not need to know how many icons are actually assigned to the marker set text values html or text to show in info window on marker click string description this will set up an info window popup when you click the marker if you specify as a string it will make a regular ginfowindow if you specify as an array it will make a tabbed ginfowindow where the array keys are the tab titles and the array values are the contents of the tabs example point a notes anything put in here will be sent inline to the javascript side so if you are planning on using complex popups you may want to consider using rmt instead tabs values array description tab titles and html or text to show in info window on marker click example array name em united states em currency united states dollar notes anything put in here will be sent inline to the javascript side link values a url to go to when the marker is clicked string description this will program the marker to act like a hyperlink example http googlecom notes it is pointless to specify text or tabs at the same time as link as link causes immediate navigation away from the map rmt values path to append to the rmtcallback string description when using ahah markers this should be set to the identifiers expected by your callback example 150 notes if you need to pass multiple identifiers just seperate them with slashes opts values array description filling out this parameter will allow you to override the gmarkeroptions that a marker is initialized with the icon key is automatically filled in you can t set it here example array bouncy true notes the documentation for gmarkeroptions can be found here  options values array description this is used similar to how behavior works at the map level example array autoclick notes available options autoclick automatically causes a click event on this marker useful when you want to automatically show an info window shapes shapes are the non point features on the map shape array  type   points  array  center  array 00  radius  0  point2  array 00  numpoints  10  style  array  type values circle polygon rpolygon line string description determines how the shape is processed circles and rpolygons are converted into lines with javascript math example circle notes line is drawn as a gpolyline polygon is drawn as a gpolygon circle and rpolygon regular polygon are special cases of polygon  points values array array lat1 lon1 array lat2 lon2 array latn lonn description an array of points defining the shape used by the line and polygon types example array array 44205835001 703674316406 array 443159879052 686096191406 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 buggysometimes beginning and ending points are switched polygon should have at least three points the first and last points should have the same coordinates center values array lat lon description center point of circle or rpolygon  example array 44213 96411 notes  radius values float description the radius of the circle in km only used for the circle type example 100 notes big circles look more like ovals this is due to the mercator projection used by google maps point2 values array lat lon description the coordinate of a vertex on the rim of the rpolygon  only used for the rpolygon type example array 1266 5523 notes changing both the latitude and longitude in respect to the center point will make the polygon rotate  numpoints values integer description sets the number of points used to draw the circle or rpolygon  only used for the circle and rpolygon types example 20 notes don t use a very large number it will slow down the map drawing style values array stroke color stroke weight stroke opacity fill color fill opacity or string description a style array  or a key to the styles array on the map  this is the same format used for the map level styles 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 linedefault style will be used shapes of type polygon circle and rpolygon will use polydefalt in previous versions of gmap specifically all drupal 46 and 47 versions 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 using a map array  map array set up your map array output theme gmap array settings map  