Usage ------ At a minimum, you must use "(:gmap:)," but to set the latitude and longitude, you will have to use a free geocoder (e.g. http://geocoder.us/). The examples below show how you can add text to a bubble over the marker and destination address that allows the site visitor to find directions to the location. Examples: ~~~~~~~~~ (:gmap lat=38.897639 lon=-77.036583:) "Minimum for pointing to a location." (:gmap lat=38.897639 lon=-77.036583 daddr="1600 Pennsylvania, 22303" msg="Joe's Bar and Grill 1600 Ranch Drive Washington, DC 22223":) "Full example with the destination address and message." Variables --------- These are the variables that influence the behavior of the markup. The defaults are recommended for use in the configuration file for your PmWiki Installation. The markup options may be added by the author. Defaults ~~~~~~~~ * $GmapLon = default longitude * $GmapLat = default latitude * $GmapZom = default zoom * $GmapJS (leave blank) * $GmapCtrl = default control size (small|large) defaults to large * $GmapType = default map type (normal, satellite, hybrid). Markup Options ~~~~~~~~~~~~~~ * ctrl = designates the size of the arrow button control (small|large) * daddr = destination address (which allows directions to the address) * lat = lattitude * lon = longitude * msg = what text is displayed in the window over the marker. You will have to provide the HTML. * type = the map type ('nor'mal, 'hyb'rid, 'sat'ellite) * zom = the zoom level. Release Notes ------------- * v1.0 - May 17, 2006: Initial Public Release by Ben Wilson. * v1.0.1 - May 22, 2006: Release by Ben Wilson. * Incorporated Google Map API v2.0+ compliance corrections by Des. * Replace $GmapCert with $HTMLHeaderFmt call. * Fixed problem with CSS via $HTMLStylesFmt. * Added support for dynamic scaling of controller. * Added the overview map. * Added support for map type (satellite, normal or hybrid). * Only add the directions block when directions are offered. Before, directions were only offered when a message was given. * Only add the message block when the message is offered. * v1.0.2 * Added map type control buttons * Fixed default operation of map control sizing * Fixed spelling error that prevented the parser selecting the desired map control size. */ $MapHtml = "
"; SDV($GmapCtrl, 'large'); SDV($GmapJS, ' '); SDV($GmapLon, '-122.141944'); SDV($GmapLat, '37.441944'); SDV($GmapType, 'nor'); SDV($GmapZom, 8); Markup('gmap', 'block', '/\(:gmap(.*?):\)/e', 'Gmap("$1");'); function Gmap($input='') { global $GmapLon, $GmapLat, $GmapZom, $GmapJS; global $GmapType, $GmapKey, $GmapCtrl; global $MapHtml, $ScriptHtml; global $HTMLStylesFmt, $HTMLHeaderFmt; $HTMLStylesFmt['gmap_api'] = 'div#map{ height: 400px; width:100%;}'; $HTMLHeaderFmt[] = ''; $opt = ParseArgs($input); $zom = ($opt['zom']) ? $opt['zom'] : $GmapZom; $lat = ($opt['lat']) ? $opt['lat'] : $GmapLat; $lon = ($opt['lon']) ? $opt['lon'] : $GmapLon; #-------------------------------- # Check for directions $dad = ($opt['daddr']) ? $opt['daddr'] : $GmapDaddr; if ($dad != '') { $directions =<< 'G_SATELLITE_MAP', 'hyb' => 'G_HYBRID_MAP', 'nor' =>'G_NORMAL_MAP', ); $map_type_key = ($opt['type']) ? $opt['type'] : $GmapType; $map_type = $map_type[strtolower(substr($map_type_key,0,3))]; #-------------------------------- # Handle the Message. if ($opt['msg']) { $opt['msg'] = preg_replace('/>/','>',$opt['msg']); $opt['msg'] = preg_replace('/</','<',$opt['msg']); $message = " html +='$opt[msg]';"; } else { $message = ''; } if ($message != '' or $directions != '') { $output = "var html = '
';\n$message$directions"; $window = "marker.openInfoWindowHtml(html);"; } $GmapJS =<< // GMAPJS; return "$MapHtml"; }