Google Maps Extensions/GMap/Docs
from http://www.schwen.de/wiki/GMap
see also:
Inhaltsverzeichnis
Installation
1. Unzip
- Unzip the archive into your extensions directory and add
include("extensions/gmaps/gmaps.php");
to your LocalSettings.php.
2. Get Map-Key
- Apply for a Google Maps site key here. Insert this key into gmaps/gmaps.php on line 37
$gmapKey='<your key>';
3. Cosmetics
- For better compatibility with IE check your skins directory and insert
xmlns:v="urn:schemas-microsoft-com:vml"
into all <html> tags in the skin-files. Mine looks like this now (MonoBook.php line 54 excerpt):<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml" xml:lang="<?php $this->text('lang') ?>" lang=.....
Usage
lets start with the most complicated example
<gmap lat="40.748" long="-73.886" zoom="5" helper="line" width="500" height="400" precision="5" type="satellite"> points: 40.763905|-73.826374|Flushing YMCA. website 40.75974059207392|-73.82898330688477|Main Street station (7 line)
lines: ff0000|3|0.5|40.759741|-73.828983|40.759220|-73.831043|40.758635|-73.832674|40.758180|-73.834305|40.757855|-73.836021|40.757335|-73.837652|40.755742|-73.841643|40.753726|-73.848510|40.750931|-73.857822|40.750085|-73.860569|40.749533|-73.865504|40.748948|-73.870826|40.748232|-73.877950|40.747582|-73.884215|40.746314|-73.896103|40.745501|-73.903527|40.745306|-73.905587|40.745306|-73.906960|40.745176|-73.908162|40.744721|-73.910480|40.742998|-73.916187|40.742900|-73.916702|40.742900|-73.917431|40.743583|-73.923376|40.744672|-73.932538|40.744770|-73.933139|40.745322|-73.933868|40.749110|-73.937838|40.749338|-73.938096|40.749663|-73.938525 </gmap>
Note how you can append new coordinates to the textarea above by clicking on the map.
Here comes the code:
<gmap lat="40.748" long="-73.886" zoom="5" helper="line" width="500" height="400" precision="5" type="satellite"> points: 40.763905|-73.826374|Flushing YMCA. [http://www.ymcanyc.org/sub.php?p=services&sp=guest/guestbrookqueens website] 40.75974059207392|-73.82898330688477|Main Street station (7 line) lines: ff0000|3|0.5|40.759741|-73.828983|40.759220|-73.831043|40.758635|-73.832674|40.758180|-73.834305|40.757855|-73.836021|40.757335|-73.837652|40.755742|-73.841643|40.753726|-73.848510|40.750931|-73.857822|40.750085|-73.860569|40.749533|-73.865504|40.748948|-73.870826|40.748232|-73.877950|40.747582|-73.884215|40.746314|-73.896103|40.745501|-73.903527|40.745306|-73.905587|40.745306|-73.906960|40.745176|-73.908162|40.744721|-73.910480|40.742998|-73.916187|40.742900|-73.916702|40.742900|-73.917431|40.743583|-73.923376|40.744672|-73.932538|40.744770|-73.933139|40.745322|-73.933868|40.749110|-73.937838|40.749338|-73.938096|40.749663|-73.938525 </gmap>
Arguments
Arguments are the name="value" pairs in the opening <gmap ...> tag.
Argument | Description |
---|---|
lat,long | Latitude, Lonitude in degrees |
zoom | Zoom factor, (-1 beeing max. and 20 min. zoom) |
width,height | Dimensions of the map window in pixels |
helper | Toggles the display of the helper box below the map, used to digitize coordinates. Two modes available helper="on" for simple mode outputting current map view settings, helper="line" to create a sequence of coordinates on click (used in the above example). |
precision | Sets number of decimal digits used in the helper widgets. Six are usually enough (last digit represents about one pixel at the highest zoom level). If you do not have enough significant digits this can cause the map to not generate. |
type | Chooses map type. Available are type="map" (default),type="satellite", and type="hybrid". |
In between the tags
The code in between the gmap tags is used to create points (markers) and lines
Point syntax
points: lat|long|wiki text for the first point lat|long|wiki text for the second point ...
A set of points commences with a single line containing only the command points:. Next are lines (one for each point) with latitude and longitude in degrees and a piece of wikitext (may contain images etc.). The wiki text will become visible in a bubble above the point, it it is clicked on.
Line syntax
lines: color|width|opacity|lat1|long1|lat2|long2|lat3|long3|.... color|width|opacity|lat1|long1|lat2|long2|lat3|long3|.... ...
A set of lines commences with a single line containing only the command lines:. Next are lines (one for each line), color being the color of the line (6 character hex, i.e. ffaa77), width an integer setting the width of the line, and opacity a float from 0 (fully transparent) to 1 (completely visible), then an arbitrary number of latitude longitude pairs.