An Update on the Ruby and Python GEOS Bindings

Its been over a year since I blogged about GEOS, an open source project that provides rich functionality for analyzing
and manipulating geometries and is a key part of PostGIS.

Sandros and Mateusz spent a ton of time refactoring and improving GEOS last year, and it looks like version 3.0 will finally be released this fall. As part of the 3.0 release, I’ve completely rebuilt the Ruby and Python bindings to use GEOS’s C API. In theory this should decouple the bindings somewhat from GEOS releases – we’ll see if that works out in practice.

Over the last couple of weeks, Mark Cave Ayland and I have spent time polishing off some rough edges. We managed to:

  • Fix various autoconf build issues
  • Get GEOS building with both older and newer versions of MingW and Msys on Windows

In addition, I added VC++ project files for the Python and Ruby bindings and updated the Ruby bindings to be more “Ruby” like.

Long story short – building GEOS and the Ruby/Python bindings should now be easier and more fool proof. If you’re in the GNU world, its as simple as:

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

If you’re in the Microsoft world, just open the VC++ solution in the source tree (thanks Mateusz), tweak the locations of your Ruby and Python installations, and hit the compile button.

So if you are using, or planning to use, the bindings I’d recommend grabbing the latest from SVN. Once you’ve built everything, then take a look at the test scripts I’ve written in the swig/ruby/test and swig/python/test directories. They should provide enough examples to get you started.

Feedback is of course welcome, particularly 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 know the right Pythonisms.

Leave a Reply

Your email address will not be published. Required fields are marked *