googlemaps is a plugin that allows using the Google Maps API from ikiwiki.

the plugin supports importing GPS tracks from gpx files, reducing the number of points in those tracks via gpsbabel, and drawing them as an overlay on the map. the center of the map and zoom level can be calculated automatically.

warning

this plugin embeds javascript code derived both from its parameters and from the contents of the gpx file, and it calls an external program. think twice before enabling it in a wiki that allows untrusted users to supply content...

usage

draw a map showing the center of vienna (example1):

\[[googlemaps lat="48.209117" lon="16.372867" zoom="16"
id="map1" controls="small,type" key="abcde"]]

draw a map with a track from a gpx file reduced to 100 points, centered on the track (example2):

\[[googlemaps trackfile="sample1.gpx" tracklen="100" controls="type"
center="track" id="track1" width="600" height="400" key="abcde"]]

common parameters

  • zoom: zoom level (required except with tracks)
  • id: id of the <div> object containing the map (required)
  • key: your Google Map API key (required for first map on the page)
  • lon, lat: coordinates for the center of the map
  • width, height: dimensions of the map
  • controls: large and small for the zoom/pan control, type for the type control, separated by commas

parameters for track display

  • trackfile: filename of a GPX file to be displayed as track
  • center: set to track to fit the map on the track
  • tracklen: number of points to reduce the track to

installation

get googlemaps.pm, install into IkiWiki/Plugin/ in one of your perl lib directories, and modify the start of page.tmpl to look like this:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
 xmlns:v="urn:schemas-microsoft-com:vml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><TMPL_VAR TITLE></title>
<link rel="stylesheet" href="<TMPL_VAR BASEURL>style.css" type="text/css" />
<link rel="stylesheet" href="<TMPL_VAR BASEURL>local.css" type="text/css" />
<link rel="shortcut icon" href="http://www.tahina.priv.at/favicon.ico" />
<TMPL_IF NAME="RSSLINK">
<TMPL_VAR RSSLINK>
</TMPL_IF>
<TMPL_IF NAME="META">
<TMPL_VAR META>
</TMPL_IF>
<TMPL_IF NAME="HEAD">
<TMPL_VAR HEAD>
</TMPL_IF>
</head>
<body <TMPL_IF NAME="BODY_PARMS"><TMPL_VAR BODY_PARMS></TMPL_IF>>

download

googlemaps.pm

license

googlemaps is copyright by christian mock and licensed under the GPL.