Grok, the Paleolithic Geographer

I've wanted to make an easily deployed and transparent application to demonstrate what can be done with zgeo.geographer and friends, the new geospatial packages for Zope, and finally inspiration struck. I chose to write a Grok project using the aptly named grokproject. Grok aims to simplify Zope to the degree that a caveman could use it. Convention over configuration and all that. It certainly allows a developer a clear view of the zgeo.* packages in action.

The paleolithic geographer isn't concerned about fancy geographic information systems. He wants a know-where-things-are system; hence the name of my demo app: Knowhere (pronounced "Oog"). Knowhere annotates resources with geographic location metadata and publishes them using GeoRSS (Atom, specifically) or KML so that a even a caveman can visualize them in the context of other geographic information on the Web.

Building and launching Knowhere is a 5 step process that requires Python 2.4, gmake, gcc, etc. Within 15 minutes you can be publishing geo-referenced content. Start by getting the code from the PrimaGIS Subversion repository:

$ svn co Knowhere

Cd into that new directory and bootstrap the project:

$ /usr/bin/python2.4

Build it out:

$ ./bin/buildout

This downloads and builds 2 C/C++ libraries (GEOS and spatialindex), and fetches a heap of eggs. It will take a few minutes.

When the build out is complete, edit 2 configuration files. In parts/zopectl/zope.conf, set the port number to an open value. In parts/app/site.zcml, change the management password from "admin" to one less obvious. That done, start up the application:

$ ./bin/zopectl fg

Browse to http://localhost:8080 (let's presume that's where it's at), authenticate, and you should see a Grok management page like this:

Add a new application named "cities" as shown, and then browse to http://localhost:8080/cities where you'll be faced with one of the ugliest forms ever seen. Fill it out like so

  • name: fort-collins

  • title: Fort Collins

  • description: Fort Collins, Colorado, USA

  • text: The little geospatial hothouse on the prairie

  • geometry type: Point

  • coordinates: [-105.08, 40.59]

using a GeoJSON coordinate representation, and submit. Click through to the new placemark page, which should be something like this. There are 5 fields on that page. Look at the Knowhere model (src/knowhere/ and you'll see that the Placemark class actually only has one attribute:

class Placemark(grok.Model):

    def __init__(self, text=None):
        self.text = text

Where are the other fields? Grok gives you Dublin Core metadata annotations automatically. No configuration required. Peek into the model's configuration (src/knowhere/configure.zcml) and you'll see that adding geographic location metadata from zgeo.geographer to any model class is as simple as:

<include package="zgeo.geographer"/>

<class class=".app.Placemark">
  <implements interface="zgeo.geographer.interfaces.IGeoreferenceable"/>

The zgeo.kml package provides KML representations of containers of georeferenceable objects. Browse to http://localhost:8080/cities/@@kml-document for an example. The zgeo.atom package provides Atom entry and feed document views with GeoRSS. For examples, browse to http://localhost:8080/cities/fort-collins/@@atom-link-entry and http://localhost:8080/cities/@@atom-search-feed.

Knowhere also includes an R-Tree spatial index from zgeo.spatialindex. Containers of the model can be made indexable as easily as:

<include package="zgeo.spatialindex"/>

<class class=".app.Demo">
  <implements interface="zgeo.spatialindex.interfaces.ISpatiallyIndexable"/>

Browse to http://localhost:8080/cities/@@manage-index to see the index management form. Future versions of Knowhere will include georeferencing event handlers, but for now you must rebuild the index manually after adding placemarks. Lame indeed, but this is just a demo (I already have a working handler for Plone AT content types). The management screen in the image below is from my demo application at, which had 2 placemarks at the time I wrote this post.

The spatial index allows fast bounding box queries. The atom search feed accepts a bbox parameter of the form minimum_longitude,minimum_latitude,maximum_longitude,maximum_latitude. For example, see,50,5,55 [map].

As you can see in the image above, zgeo.* can handle polygon geometries as well as lines and points. View that demo application in Google Earth using

There's more work to do on Knowhere and zgeo.*. The index might be better as a local utility, and I should be using an integer id utility instead of hashing content names. The HTML is wretched and the URLs cry out for rewriting (which Grok supports right out of the box). Any Zope user that can look past those warts might start to get some good ideas from Knowhere.

The Pleiades Fitness Program

Lee Martinez Park and the Poudre River trail are just a short bike ride from the AWMC West Annex. The snow was getting a little thin yesterday, but we got another 5 inches overnight. You must pounce on the snow here in town because it doesn't last long. Last winter was anomalous; I'll probably be back out in running shoes in a week or so.

KML Balloon Templating and Charts

Now that's slick.

Speaking of KML 2.2, leave it to the OGC to turn this bookmarkable, addressable web page into a 268 page Word document. Even as a PDF, discussion of the proposed spec on the internet is hampered. Unable to begin discussion like (for example) this:

I have misgivings about What do you think of it?

we're stuck instead with:

I have misgivings about section 6.5 in the PDF that's archived under Will you click through, download, unzip, search for that section and tell me what you think of it?

Can we not use the web like the IETF does?.


Re: KML Balloon Templating and Charts

Author: Yves Moisan

For a great many organizations, the web is just an access point to Office/PDF files. The city of Montréal published its "Plan de transport 2007" in May as a PDF file that you are meant to comment on through a form on their portal. Download the PDF (huge because it's all nicely imaged in final, presentable form), read it, copy/paste sections you want to comment on (presumably prepare all your comments in some text editor beforehand), then copy/paste in the forms' "Comment" text area and "Submit". EasyCommenting reinvented ;-).

OpenAerialMap Fort Collins

I just finished filling out the paperwork and voila. Christopher Schmidt did everything else. Other Fort Collins data has already been pumped into OpenStreetMap, so go ahead and click on that option.

This imagery was acquired on a bad hair day for the city. Check out our lovely City Park pond. It was being drained in preparation for dredging and installation of an aerator.


Re: OpenAerialMap Fort Collins

Author: Mike

Do you know what date/time these photo's were taken?

Re: OpenAerialMap Fort Collins

Author: Sean

"November 2002" is all the city says. You could email or call for more details.

Uranium Mining in our Backyard

I've been following the story but missed this Times piece. Fortunately, the world's best mother-in-law clipped and mailed it to us. I'm open-minded about nuclear energy, but mining around a local aquifer seems awful risky considering the scarcity of water here on the Front Range. It's also a stretch to say that the local uranium is going to reduce greenhouse gas emissions from the city since there is no new nuclear power plant coming online to replace the local coal plant.

Fort Collins's corny and expensive new city motto also gets a mention.

My Fantasy Movie

Last week, after watching "The Bourne Ultimatum" with my wife at the 2nd-run cinema on a rare adults-only date (well worth $3, by the way), I seized on the idea that somebody should stick Charles Stross and Guillermo del Toro in a room and keep them there until they've made "The Atrocity Archives" movie. They'd need a cast too, so put Simon Pegg in there to play Bob, and Christopher Plummer to play Bob's boss.

Today I discover that I'm not alone in this fantasy land. Wacky. Won't happen, of course; another Hellboy movie will have to do.

Stross dumps on Amazon's Kindle in that post, and has my favorite explanation yet for the glowing praise it got in the geo blogs: people just lost their saving throw against shiny!

Peutinger's Map

"Peutinger's" map, about which geo blogs are buzzing today, also happens to be the subject of work at the Ancient World Mapping Center. Pleiades and the Barrington Atlas cite Miller's 1916 study, the Itineraria Romana.


Re: Peutinger's Map

Author: Dave Smith

Thanks so much for the article - I particularly picked up on this part:
Despite the general familiarity of the image, however, few people have troubled to ‘read’ it, and even those few have typically limited their attention in a very localized way to the aspect which dominates the one full study ever made — namely, the extent to which the routes and distances shown are an accurate reflection of attested conditions on the ground. Moreover this study, entitled Itineraria Romana and published as long ago as 1916 by the amateur scholar Konrad Miller, is now hopelessly outdated; but still no-one has yet dared to address the map from any other perspective. Most recently (since the late 1980s), the broad debate concerning Roman ‘map consciousness’, or the lack of it, has acted as an additional deterrent to novel lines of enquiry.
I guess I can count myself among the few who have actually read it, I've worked out a number of the Latin inscriptions, have tied many (close to 200 so far) of the routes and placemarks to modern day, and have sorted out some of the many quirks of the map. I'm indeed working to understand it on a deeper level toward understanding the Roman understanding of their geography. I would imagine that accessibility of the map by scholars was likely an issue in years past...

Wikipedia Cabal Cablooie

The infamous community anti-pattern strikes again.


Re: Wikipedia Cabal Cablooie

Author: Allan

Yeah, I read that, too, thinking that every community has its backchannels. And every backchannel probably has backchannels.