Shapely for Python 3.0

2007-09-06T18:28:57Z in the lab, python

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

1Re: Shapely for Python 3.0

Matthew Giger, 2007-09-06T19:54:35Z
Are you actually moving over to 3.0 already? It's pretty alpha.

2Re: Shapely for Python 3.0

Sean, 2007-09-06T20:31:29Z
Python's my favorite tool, and I like to know where the cutting edge is.

3Re: Shapely for Python 3.0

Sean, 2007-09-06T20:35:08Z
Of course, it's also fun to have the first open source GIS package for Python 3.0.

Comments are closed after 13 days.

about archive feed find

Some rights reserved by Sean Gillies.