Project description

PostGIS-ish operations outside a database context for Pythoneers and
Pythonistas.

Shapely is a BSD-licensed Python package for manipulation and analysis of
planar geometric objects. It is based on the widely deployed GEOS (the engine
of PostGIS) and JTS (from which GEOS is ported) libraries. This C dependency
is traded for the ability to execute with blazing speed. Shapely is not
concerned with data formats or coordinate systems, but can be readily
integrated with packages that are. For more details, see:

Dependencies

Shapely 1.2 depends on:

Python >=2.5,<3

libgeos_c >=3.1 (3.0 and below have not been tested, YMMV)

Installation

Windows users should use the executable installer, which contains the required
GEOS DLL. Other users should acquire libgeos_c by any means, make sure that it
is on the system library path, and install from the Python package index:

$ pip install Shapely

or from a source distribution with the setup script:

$ python setup.py install

Warning

Windows users:
do not under any circumstances use pip (or easy_install) to uninstall
Shapely versions < 1.2.17. Due to the way Shapely used to install its GEOS
DLL and a distribute or setuptools bug, your Python installation may be
broken by an uninstall command. Shapely 1.2.17 will uninstall safely.

Usage

Here is the canonical example of building an approximately circular patch by
buffering a point:

See the manual for comprehensive usage snippets and the dissolve.py and
intersect.py example apps.

Integration

Shapely does not read or write data files, but it can serialize and deserialize
using several well known formats and protocols. The shapely.wkb and shapely.wkt
modules provide dumpers and loaders inspired by Python’s pickle module.:

That yields a Numpy array of [x, y] arrays. This is not always exactly what one
wants for plotting shapes with Matplotlib (for example), so Shapely 1.2 adds
a xy property for obtaining separate arrays of coordinate x and y values.:

1.0.5 (2008-05-20)

1.0.4 (2008-05-01)

Disentangle Python and topological equality (#163).

Add shape(), a factory that copies coordinates from a geo interface provider.
To be used instead of asShape() unless you really need to store coordinates
outside shapely for efficient use in other code.