Ruby and Python Bindings for GEOS

GEOS is one of the more important
open source projects in the GIS/geospatial industry.
It provides rich functionality for analyzing
and manipulating geometries and is a key part of PostGIS.

A few months ago I described how
to use GEOS from Ruby. Back then, it was fairly painful and involved
getting down and dirty with SWIG and your favorite compiler.

Happily time moves on. Sandros and Mateusz have
done a ton of refactoring over the last couple of months and the Geos 3.0 release
is at last in site (hopefully it will happen a bit later this summer). And I’ve
checked in a number of changes that improve the Python and Ruby bindings.

The most significant change is that its now much easier to compile the bindings.
All you have to do is:

./configure --enable-python --enable-ruby

You’ll still need SWIG 1.3.29 installed, but the plan
is to include the SWIG generated wrappers in the distribution so you won’t need
SWIG at all. And if you’re on Windows, the bindings compile without problems
using Visual C++ 2005. I still need to check MingW.

So if you have some time, grab the latest from CVS and see if the bindings compile
and work on your platform.

I’d particularly like to get feedback from Python users.
Since I use Ruby day in and day out, I know the right Rubyisms
to put into the bindings. But I don’t know Python well enough to get the Pythonisms
right. So let me know if there are things missing like special methods or iterators,
and I’ll add them in. Comments should be posted to the geos
mailing list so everyone can see them.

Leave a Reply

Your email address will not be published.