Note: Google has disabled the API version used by this recipe and now serves a special script that is capable to display most simple embedded maps, but not all. If you need to embed maps, please see Ape: Automagical PmWiki Embed or OpenLayersAPI.
A simple and easy inclusion of Google Maps into wiki pages.
This recipe allows inclusion of Google Maps in wiki pages. It aims to be a simple and easy way to publish a map on your wiki.
Usage in a wiki page
To include a map, first you get a link from Google Maps, then add this link in the wiki page.
Go to http://maps.google.com/ and find the place you want to show. Select Map, Satelite or Hybrid view, zoom in, and double-click to center the map.
On the right-top corner of the map, click "Link to this page", and copy the first address.
In your wiki page, paste this address as a normal link :
[[ http://maps.google.com/... | Our location ]]
When you preview or save your page, the link will automatically be shortened like this:
When you view your page, a map will be created, with a red pin -marker- at the center. Clicking on the pin will open a popup window containing the link text.
You can also just write a GMap: link with the
[[ GMap:ll=48.853213,2.349116&z=15 | Notre-Dame de Paris ]] [[ GMap:ll=-22.904325,-43.209743&z=3 | Rio de Janeiro ]]
Negative degrees should be used for Western longitudes and Southern latitudes, see the example for Rio de Janeiro (22.9°S = -22.9°, 43.2°W = -43.2°).
Two other options exist:
Advanced usage : many pin markers in one map
This is done in a special :term:definition list.
: %gmap% [[GMap:ll=...]] : Center, view and zoom of the map : GMap:ll=48.84,2.31 : First pin description : GMap:ll=... : Second pin description : GMap:ll=... : Third pin description img.jpg
Go to Google Maps and select the default view and zoom of your map. Copy the link from the top-right corner.
The first line of the definition list contains the style
The next lines contain links to the pins' coordinates, and the description of each pin. (To get the links to a pin, center the map where it should appear, and copy the link from the top-right corner.)
The link of each pin needs only the numbers after
The pin description may contain formatting, styles, colors, images, other links etc.
More precise placement of the pins (moving a marker)
From version 20090513, it is possible to get the precise coordinates from within the wiki page.
This only works in "Preview" mode, when you edit the wiki page and press "Preview" instead of "Save".
In the map preview, you can drag the pin with your mouse, and when you drop it on the correct position, an info-tip window will appear showing the current coordinates of the pin like a
This is the easiest way to fix a slightly imprecise pin. Note that the zoom factor is not displayed and you may add, e.g.
There is also a button "Center" near the top-right corner of the map. Clicking on it displays the current center and zoom of the map and a link for easier pasting in the wiki page (for maps with multiple markers).
You can set the default map size in config.php, either in pixels, or in percents :
$GMap['H'] = 200; # default is 300 pixels $GMap['W'] = '95%'; # default is 100%
You can disable the map controls or the red pin marker with :
$GMap['nocontrols'] = 1; # default is 0 (0 = controls enabled) $GMap['nomarker'] = 1; # default is 0 (0 = markers enabled)
You can also control the display of maps via the link title:
[[GMap:ll=...&z=16"nocontrols;nomarker;w:300;h:400" | My map ]]
The commands are separated with semi-colons ";" and you can have any of them. They mean:
In advanced multi-maps, the first GMap: link may contain these commands:
: %gmap% [[GMap:ll=...&z=15"nocontrols;h:500"]] : (first line)
See discussion at GMap-Talk