GeoTagging

Summary: Geotagging support within PmWiki using GeoRSS and KML compliant output options
Version: 1.2 (03 Nov 2009)
Prerequisites:
Status: Release
Maintainer: Smc
Categories: RSS, Integration
Discussion: GeoTagging-Talk

Questions answered by this recipe

  1. How can I geotag my wiki pages?
  2. Does PmWiki support geotagging?
  3. How can my wiki provide a live GeoRSS or KML compliant feed?
  4. How can I get geographic search engines to trawl my web site and find geo-located pages?

Description

Geotagging support within PmWiki using GeoRSS and KML output options

Installation

1. Please download the following files and save in your cookbook folder:

  • georssfeeds.phpΔ - it's a copy of PmWiki core feeds.php with one line changed (see file header for details)
  • georsswiki.phpΔ - it creates new (:coord:) markup and configuration of geotagging outputs used by above georssfeeds.php module

Configuration

1. local/config.php should be appended with the line:

include_once("$FarmD/cookbook/georsswiki.php");

2. To add a 'KML' link for pages with geotagging information, edit your Wiki's Site/PageActions page to add the following:

(:if ! equal {*$Latitude} "":)
* %item rel=nofollow class=kml% [[{*$FullName}?action=pagekml  | KML ]]
(:ifend:)

3. To add a 'GeoRSS' and 'KML' link for RecentChanges output with geotagging information, edit your Wiki's Site/SideBar page (or any other page) to add the following:

* Geo Feeds: [-[[Site/AllRecentChanges?action=georss | GeoRSS]] [[Site/AllRecentChanges?action=kml  | KML]]-]

Testing Out

1. Create and save one or more wiki pages e.g. WikiSandbox with the following markup somewhere within (adjust the coordinates to suit). The lat= and lon= can be omitted IF you make sure you input latitude space longitude (in that order):

(:description This is a test geotagged wiki page:)
(:coord lat=52.1234 lon=-2.2345:)

2. You'll now notice a new 'KML' link on your PageActions area. If using the standard PmWiki skin it's at the top right of your screen. Click this link to produce a KML file which can be loaded into GoogleEarth. On loading into GoogleEarth you'll be zoomed into and auto centered on a new pushpin. Click the push pin to display summary information about your page which has a URL link back to your wiki page. Example screen shot below:

3. You'll also notice two new links on your sidebar next to 'Geo Feeds' called 'GeoRSS' and 'KML'. Click this link will produce an appropriately formatted GeoRSS or KML feed from a list of all recent changes. The KML link, when opened in GoogleEarth will show the location of all wiki pages on the map. The GeoRSS feed can be feed you favorite web map server with similar data.

Integration

The following new page actions are available:

ActionDescription
?action=georssRSS 2.0 compliant output implementing GeoRSS simple format ref. http://www.georss.org/simple
?action=georssdcDublin Core compliant output implementing GeoRSS simple format as above
?action=kmlKML 2.1 compliant output using the basic format ref. http://code.google.com/apis/kml/documentation/kml_tut.html#basic_kml
?action=pagekmlSame as above, but should only be used for single pages (not [All]RecentChanges output)
<meta name>"ICBM" and "geo.position"These meta tags are in the HTML output of any page with the coordinates markup. The ICBM and geo.position meta name tags are defined here: ref. http://en.wikipedia.org/wiki/Geotagging#HTML_pages

Design Notes

Added custom markup directive (:coord:) to save geotag information as a {$Latitude} and {$Longitude} page variable. We reuse Pm's core RSS feed capability with new configuration to output KML and GeoRSS feeds using the ?action parameters defined above. This allows you to pin wiki pages to your favorite desktop of web mapping software e.g. GoogleEarth. Each wiki page also has meta name tags called 'ICBM' and 'geo.position' which allow your pages to be indexed by geo search engine bots.

Future Enhancements (in priority order)

  1. Be able to perform some simple validation of the coord lat/lng entries so we don't end up producing GeoRSS or KML output which has user errors in the coordinates. A simple check that they have entered two comma separated values between +/- 180 would be a good start. Even better would be to warn the user after hitting submit to save the page in the same way that 'RequireAuthor' recipe does - it takes you back to the edit page with red text at the top saying the reason why.
  2. Add support for and optional Altitude field and an optional 'placename' field in the 'coord' markup
  3. Remove my dependency on a copy of Pm's feeds.php file which I distribute as georssfeeds.php - it only has one line changed to ensure that our KML output only includes entries which have coordinates. I'm using Pm's standard feeds.php for the GeoRSS output as systems should expect to cope with that. KML processing systems are a little more sensitive - GoogleEarth is!
  4. Expand the summary information output within the GeoRSS and KML feeds. I'd like to make it configurable by allowing an 'opt=' item to the 'coord' markup and/or configuration as to how to construct the summary information e.g. Add backlink to Wiki page, add page description, add page summary, etc.

Release Notes

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".

  • 03 Nov 2009: Replaced markup with (:coord lat=xx lon=yy:) with a special thanks to HansB for his help. Updated so each page adds compliance with meta name 'ICBM' and 'geo.postion' output for recognition by Geo Search Engine Bots.
  • 31 Oct 2009: Updated for compliance with GeoRSS simple format.
  • 30 Oct 2009: Initial publish of first beta release for wider testing.

Comments

See Discussion at GeoTagging-Talk

See Also

  • None.

Contributors

  • Smc - Author
  • HansB - For helping convert to the new (:coord:) markup.

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.