[pmwiki-users] Geotagging for PmWiki

stevecrisp at gmail.com stevecrisp at gmail.com
Thu Oct 29 16:04:17 CDT 2009


All,

A follow-up to my last email.  It's been an epic but I've solved most of the
technical hurdles for producing a GeoRSS feed from Pmwiki.  I could do with
your help on extending PmWiki's 'feed.php' below.

As proof of concept I'm adding two new custom mark-ups to save PTV's
representing latitude and longitude for each page.  My mark-up in wiki pages
is:

(:latitude 50.1234:)
(:longitude -1.23456:)

I get PTV's into the system using the following:

$FmtPV['$Latitude'] = '@$page["latitude"]';
$FmtPV['$Longitude'] = '@$page["longitude"]';
$SaveProperties[] = 'latitude';
$SaveProperties[] = 'longitude';

I add my own custom feed format handled by PmWiki's core 'feed.php' script
using (copied from existing rss entry):

SDVA($FeedFmt['georss']['feed'], .... <--- same as Pm's core rss line
[snipped here]

SDVA($FeedFmt['georss']['item'], array(
  '_start' => "<item>\n",
  '_end' => "</item>\n",
  'title' => '{$Group} / {$Title}',
  'link' => '{$PageUrl}',
  'description' => '{$Description}',
  'geo:lat'  => '{$Latitude}',
  'geo:long'  => '{$Longitude}',
*  'georss:point' => '{$Latitude} {$Longitude}',    <------- please look
here
*  'dc:contributor' => '{$LastModifiedBy}',
  'dc:date' => '$ItemISOTime',
  'pubDate' => '$ItemRSSTime',
  'enclosure' => 'RSSEnclosure'));

I include the above using:

if ($action == 'georss')  include_once("scripts/feeds.php");

If I draw your attention to the 'georss:point' line which concatenates
latitude and longitude, adding a space character in the middle.  All this
works fine when I have a lat/lng defined in my page.  The problem I have is
that when a page doesn't have a lat/lng I get the 'georss:point' line in my
rss output with the value set to a space.  The thing I like about the other
'geo:lat' and 'geo:long' lines is that they are automagically removed from
the rss output if the page doesn't contain them.

How can I get this behaviour with the 'georss:point' line above?

If I can get this solved I'll write it up as a recipe for others to play
with.

Thanks in advance,
-Steve.

2009/10/19 <stevecrisp at gmail.com>

> Dear Pm community,
>
> As per title I'm attempting to write a proof of concept PmWiki recipe for
> geotagging support in PmWiki.  I could do with some design advice on my
> embryonic ideas/ramblings below:
>
> (1) We want to add geotag to relevant wiki pages.  New markup needed
> (:coord <lat>, <lng>:) e.g. (:coord 52.12345, -1.23456789:).  This would
> create metatags in the resultant html output in keeping with say Wikipedia's
> ideas here:
>
> + http://en.wikipedia.org/wiki/Geotagging
> +
> http://en.wikipedia.org/wiki/Wikipedia:WikiProject_Geographical_coordinates
>
> So we have geotagged page we need to get to the data (from other
> applications) in various ways; GeoRSS feed, backend database
>
> (2) For the GeoRSS feed I'm hoping I'll simply reuse one of the existing
> RSS feeds and convert the output to GeoRSS XML output.  Hopefull I'll be
> able to get this working for Recent Changes for example.  GeoRSS is good as
> many mapping clients consume this.  I could also adapt for output of KML
> also lets not jump before I'm walking!
>
> (3) The end goal for the database backend is we could use PmWiki to display
> relevant content to a specified grid reference, and a few quick geodetic
> calculations could give me a list of pages with content near to a specific
> coordinate.  This is a bit like Flikr for photos.  I'll start with the
> SQLite receipe (http://www.pmwiki.org/wiki/Cookbook/SQLite) as I've used
> this before with PmWiki.  I could add two new columns to the 'pages' table
> which will extract the latitude and longitude data from my new markup as per
> (1) above.  This will help me perform quick distance calculations at a later
> time without inspecting the page content.  Ideally I'd use either Postgres
> (PostGIS extensions) or MySQL backend (with geo extensions).
>
> For those that are still reading, I've the following initial questions:
>
> (a) has this been done before?
> (b) if not, does the above sound achievable (assuming a few pointers from
> this community as I uncover issues)?
> (c) I assume I'll copy the (:summary:) markup item to create new new
> (:coord:) markup.  Is this good practise?
> (d) Will a customer RSS feed (read GeoRSS feed) be possible from the
> content of data available from the recent changes RSS feed?  I'll need page
> title and coord markup within the XML output.
> (e) For the database backend, starting with SQLite recipe, can I simply add
> two columns (lat & lng) and have the new (:coord:) markup be parsed by it?
>
> Any advice very much welcome.
> --Steve.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.pmichaud.com/pipermail/pmwiki-users/attachments/20091029/699ee5f3/attachment.html 


More information about the pmwiki-users mailing list