From Meta, a Wikimedia project coordination wiki
A proposal to move this page to was rejected.
Google Map Extension

This extension integrates a google map into a wiki page. Optionally it displays geo tagged data of an xml/rss/gpx source. Further markers can be interactively added to a map.


Using an external xml geo information file

<gmap> rss= 
| width=600  | height=500 | zoom=15 | lat=39 | lon=28 </gmap>
Add a marker

Interactively creating/adding new markers

   <gmap> rss=GmapXML/ | width=600  | height=500 
| zoom=15 | lat=39 | lon=28 </gmap>

GPX-Geocaches in down under


GPX-Yosemite Falls Trail



This is an extended version of the Google map extension from User:IndyGreg, [1].


  • This page and the code pages gmap.js and gmap.php have been updated on 2 August 2005 Mafs.
  • 3 August 2005 : in section MonoBook.php missing body tag added.
  • 30 August 2005: update to mediawiki version 1.5rc4
  • 7 September 2005 new version: markers can be interactively created/added. The scripts gmap.php and gmap.js contain many changes.
  • 8 September 2005 bugfix. An expression like rss=Test/Test/ between the gmap tags was not correctly handeled. The scripts gmap.php and gmap.js have been amended.
  • 21 September 2005: GPX support added. The files gmap.php, gmap.js and MonoBook.php have been updated.
  • 28 September 2005: Caching disabeled, it does not work correctly - gmap.php updated.
  • 16 October 2005: Pages which have interactively created may contain a redirect to an other wiki page - gmap.php updated.
  • 07.05.2008 changed function wfDisableCache (). Now compatible with MediaWiki 1.12 --Wikinaut 12:39, 7 May 2008 (UTC)


The extension has been tested with mediawiki version 1.5rc4, Firefox and Internet Explorer. There might still be bugs. Extension does not work properly on mediawiki version 1.4.7 (for further bugs, suggestions, etc. see User_talk:Mafs/GoogleMapExtension).

Get a key from Google[edit]


Add these lines to LocalSettings.php and fillin your key.

$wgGmapKey = "Your_Google_Map_Key";
$wgGmapSource = "";


See this wiki page and download the code to subdirectory /extensions as gmap.php.


See this wiki page and download the code to subdirectory /skins/common as gmap.js.


The script /skins/MonoBook.php (MediaWiki 1.12.0) has to be modified by replacing the function function execute() with the code published on this wiki page.


The rss files are stored in a cache. Therefore, you must create a cache folder, eg. /your_wiki_folder/cache, which has to be writable by your web server. If you choose another name for your cache, you will have to adapt the name in gmap.php.


Use one section between <gmap>-tags for each map. The section may contain parameters separated by a pipe ("|"), just like links and templates. These parameters are supported:

  • rss=exp is optional and points to an external rss/xml/gpx resource file or wiki pages containing geo xml or gpx information data:
    1. If "exp" starts with "http://" (eg. ) than the respective external resource file will be fetched and stored in a cache (see screenshot).
    2. If "exp" terminates with a slash-"/" (eg. rss=GmapXml/) than, after clicking on the map, a blue marker appears on the map and a link "Create" pointing to a wikipage is displayed below the map. Follow the link and write something on the page. Note that the page title contains the lat/long information of the marker. Go back to the map and refresh your browser. You should see the newly created marker. When clicking on the marker you see that at least part of the first line of the wiki page is rendered as link to the page. (If you write the tag "<disabledisplay/>" on the wiki page, no marker will be shown on the map for this particular page.)
    3. In all other cases "exp" is interpreted as a wiki page which has to contain valid xml or gpx geo information data (for an sml example see below).
    • Multiple xml geo information sources can be specified ( rss=source1 | rss=source2 ), their data is merged and rendered into one map.
    • GPX waypoints are displayed using a marker, for GPX tracks and routes a polyline is used. (All track and route segments are connected to a single line. A maximum of 500 track/route points are displayed.)
  • lat=x latitude
  • lon=y longitude
  • zoom=z zoom factor (1 represents detailed view)
  • width=a the width of the map in px
  • height=b the hight of the map in px
  • info=text displays the expression "text" in the centre of the map
  • maxrss=n the first n xml items are shown
  • controls=yes show some google controls
  • type=q q can be "satellite, "street" or "hybrid"

Example of xml rss geo xml information data[edit]

<?xml version = '1.0'?>
<rss version="2.0" xmlns:geo="" xmlns:dc="">
    <title>Geomap Data</title>
    <link> </link>
    <pubDate>July 2005</pubDate>
      <geo:lat >48.4003</geo:lat>
      <geo:long >11.7455</geo:long>
      <geo:lat >53.8721</geo:lat>
      <geo:long >8.7090</geo:long>