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.
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:
- Collective Mapping
- Community History
- Tourism Information
- Urban Climbing Locations
- Public Art
- Anything you want to capture on a map & could be tied into a wiki!!!
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 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.
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.
I found these links useful when developing and debugging this recipe:
- Google Maps API
- Google Maps GeoCoding
- Google Maps Articles
- Google Maps PHP/MySQL
- GMap2 Object
- Map Icons
- GMaps Params
- KML API
- Apple Dev Center iPhone
- Test KML
- Sample KML
- GMaps Geo Encoder
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".