Shapely is a Python package for manipulating and analyzing planar geometric objects in the Cartesian plane, backed by GEOS.
Overview
Shapely lets Python programs work with planar geometries: points, lines, polygons, and the relationships between them. It wraps the GEOS library so operations run in native code while exposing a Geometry interface for single shapes and NumPy-oriented universal functions for arrays of geometries.
You can work with one geometry at a time (for example buffering a point into a circular patch) or vectorize checks across many geometries without writing Python loops. Operations support array broadcasting, and many routines release the GIL so GEOS work can run concurrently from one process when you use threaded code carefully.
The package is not aimed at file formats or coordinate reference systems, but it can serialize and deserialize via WKB, WKT, and GeoJSON-like mappings, and can integrate with other Python GIS stacks. Install it through common Python package channels such as pip or conda-forge.
Key features
- GEOS-backed planar geometry operations
- Scalar Geometry interface for single shapes
- NumPy ufuncs for geometry arrays
- WKB and WKT load and dump helpers
- GeoJSON-like mapping integration
- GIL release for threaded GEOS work
- Buffer, contains, and spatial predicates
- NumPy array broadcasting support
Use cases
- GIS geometry processing in Python
- Vectorized point-in-polygon tests
- Building buffers around points or lines
- Interchange with WKT or GeoJSON data
- Spatial analysis with NumPy workflows