Shapely for Python 3.0

Shapely is a thin wrapper for libgeos_c. How thin? With help from the 2to3 tool, I ported Shapely to Python 3.0 in less than an hour -- that's how thin. Since distutils and setuptools aren't quite ready to go, you will have to get the code from the lab repository, add it to your path, and import it in place if you want to try it out:

$ svn co http://svn.gispython.org/svn/gispy/Shapely/branches/py3k spy3k
$ PYTHONPATH=spy3k /usr/local/py3k/bin/python
Python 3.0a1 (py3k, Aug 31 2007, 17:11:43)
[GCC 4.1.2 20060928 (prerelease) (Ubuntu 4.1.1-13ubuntu5)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from shapely.geometry import Point
>>> p = Point(0.0, 0.0)
>>> p.wkt
'POINT (0.0000000000000000 0.0000000000000000)'
>>> p.buffer(10.0)
<shapely.geometry.polygon.Polygon object at 0xb7ccddec>
>>> p.buffer(10.0).area
313.65484905463717

Comments

Re: Shapely for Python 3.0

Author: Matthew Giger

Are you actually moving over to 3.0 already? It's pretty alpha.

Re: Shapely for Python 3.0

Author: Sean

Python's my favorite tool, and I like to know where the cutting edge is.

Re: Shapely for Python 3.0

Author: Sean

Of course, it's also fun to have the first open source GIS package for Python 3.0.