Plone Geo Interoperability

Update (2008-01-09): I have a demo running. Try the KML document at http://sgillies.net/pgx/locations/@@kml-document in Google Earth (should launch for most of my blog readers) and see how you can navigate back to Plone through the link in the placemark bubble.

Yesterday I made a beautiful little ASCII chart showing the gap between Maps and the zgeo packages. Maps has a slick Plone widget for geo-referencing simple location content, and a map view mode for containers that beats the one I implemented for Pleiades. If all your locations are point-like and are going to be viewed exclusively through your Plone site, Maps is pretty much all you need. On the other hand, if you want to serve your geo-referenced content out to the "GeoWeb", view it Google Earth, remix it using Pipes (or Mush), or analyze it in a internet GIS application, you need the features provided by zgeo.*.

Zope's component architecture was designed in part to make it easier to bridge such gaps. Since I'm the one arguing that there is a real benefit to a less naive GIS approach, the obligation to build the bridge is on me. Geographer is my solution. It allows Plone content to be annotated with rich geospatial metadata and provides interfaces useful for generating KML and GeoRSS documents for the GeoWeb. It also adapts Maps Location objects and other content annotated using the geolocation product so that these objects can be represented in KML or GeoRSS documents or analyzed in modern GIS software.

I tested it with Maps this afternoon and made Atom + GeoRSS feed and KML documents from a folder of locations with the zgeo.atom @@atom-search-feed and zgeo.kml @@kml-document views.

The Geographer wiki page has installation instructions for Plone 3. The tricky part for a conventional non-buildout deployment is installing the zgeo packages into your Plone python and installing the ZCML slugs into the instance's etc/package-includes directory. If you drop Geographer into your site's products folder without doing the above, your site will break. Get it right and you can try the above views on folders of your existing geo-located content.

It's far easier to use a Plone buildout, and I'm providing one. All the zgeo packages will be installed and configured. The Maps product is included as well. Get it from the repository and build it out like this:

$ svn co http://svn.gispython.org/svn/zope/geo-products-example/trunk pgx
$ cd pgx
$ python bootstrap.py
$ ./bin/buildout
$ ./bin/instance start

This will start Zope 2.10 on port 8080 with a manager role, username: admin, password: admin. From here there are 4 steps to geo-referenced content:

  • Create a new Plone site through the ZMI with id "plone"

  • Add a new top-level Folder "places" as a container for geo-referenced content.

  • In /plone/places, make a new Page with id "test"

  • Go to the location http://localhost:8080/plone/places/test/@@edit-geo-form, enter [0.0, 0.0] in the coordinates field and submit. Yes, I know, the Maps widget is much better. I'm working on it, believe me.

Now you have a geo-referenced page. You can get a KML document representing the places folder at

http://localhost:8080/plone/places/@@kml-document

That's Geographer and zgeo.* in a nutshell.