talira

Python library for manipulating and analysing planar geometric objects, on GEOS

open sourceBSD-3-Clausefree

Shapely is a Python package for manipulating and analysing planar geometric objects (points, lines, polygons and their collections) in the Cartesian plane. It wraps GEOS, the geometry engine behind PostGIS, and offers both a Geometry interface for single geometries and fast vectorised NumPy ufuncs for arrays of them, releasing the GIL so the heavy work can run in several threads. It doesn't deal with file formats or coordinate systems itself but works alongside packages that do.

Problems it solves

  • check whether a point is inside a polygon in Python
  • buffer, intersect and union shapes for GIS analysis in Python
  • run geometry operations on large arrays of shapes quickly with NumPy

Features

  • points, lines, polygons and collections in the plane
  • GEOS geometry operations such as buffering, through a Geometry interface
  • vectorised NumPy ufuncs for arrays of geometries
  • releases the GIL so operations can run in parallel threads
  • pip and conda-forge builds

Limitations

  • It doesn't handle file formats or coordinate reference systems; you pair it with other packages for those.1
  • Shapely 2.3 needs Python 3.12 or later, GEOS 3.11 or later and NumPy 1.26 or later.1

Alternatives

The same job

These do what Shapely does.

  1. GeoPandas Geographic data support for pandas DataFrames in Python
  2. QGIS Free and open source geographic information system for Linux, Windows and macOS

Compare Shapely with the top 3