MapWiki

Summary: Map+Wiki Mashup; or how to make customized Google Maps using a wiki backend.
Version: 1.0
Prerequisites: EnableHTML, a MySQL database.
Status: beta
Maintainer: Ryan O'Toole
Discussion: MapWiki-Talk?

Questions answered by this recipe

How can I create a customized Google Map using a wiki as the back end? How can these individually embedded maps be aggregated into a single multi-point map, with the map markers linking back to the corresponding wiki page?

This section is optional; use it to indicate the types of questions (if any) this recipe is intended to answer.

Description

Useful for easily populating a nice looking Google Map with data drawn from the pages of your wiki. Good for making your own custom maps. Good for groups of people to collectively populate a wiki with embedded maps which are then automatically aggregated into a single multi-marker map whose markers link back to the individual wiki pages. Use cases:

Examples

Requirements

Notes

Preface

In this tutorial I'll assume a working knowledge of MySQL, and stick to only higher level discussion of getting the application up and running.

Setup MySQL Database

Create a new database called "mapwiki". If your web host only allots you one database, then skip this step.

Import these tablesΔ into the "mapwiki" database. If you didn't create "mapwiki", then just import the tables to whatever DB you have. The table names are prefixed with "mapwiki_", so it is unlikely they will conflict with existing table names. If you completed this step correctly, you will see three tables in the DB: mapwiki_locations, mapwiki_category, mapwiki_loc-cat.

Optionally, create a user with limited privileges (INSERT and UPDATE only perhaps) to access these tables from the scripts. I usually do this, so I'm not sticking superuser passwords into my plain text script files.

Install EnableHTML

Install Enable HTML, then enable the HTML tags form, input, object, param, embed & iframe. This will prevent the wiki from trying to escape the Google Maps embed code.

Install MapWiki

Copy mapwiki.phpΔ into your cookbook directory. Edit mapwiki.php, filling in the database connection variables (see source comments). Add the following to your config file: include_once("cookbook/mapwiki.php");

Copy mapwikixml.phpΔ into your site's document root. This file can actually be placed in any web accessible directory within the site, as long as it can find the "cookbook/mapwiki.php" script in the include path.

Create a new skin using this template as a starting point: pmwiki.tmplΔ. Refer to the Google Maps API (see links bellow for more specific pages dealing with markers, parameters, and map objects) to interpret the JavaScript you'll find in the template. The JavaScript defines what the markers look like and where the KML data is pulled in from.

Links

I found these links useful when developing and debugging this recipe:

Release notes

Version 1.1 2010-03-13: Updates to the explanations and files of this recipe.

Version 1.0 2009-11-28: Beta release. Many loose ends, but essentially functional.

If the recipe has multiple releases, then release notes can be placed here. Note that it's often easier for people to work with "release dates" instead of "version numbers".

Contributors

Ryan O'Toole

Comments

See discussion at MapWiki-Talk?

User notes? : If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.