shapely 2.1.1


pip install shapely

  Latest version

Released: May 19, 2025


Meta
Author: Sean Gillies
Maintainer: Shapely contributors
Requires Python: >=3.10

Classifiers

Development Status
  • 5 - Production/Stable

Intended Audience
  • Developers
  • Science/Research

License
  • OSI Approved :: BSD License

Operating System
  • Unix
  • MacOS
  • Microsoft :: Windows

Programming Language
  • Python :: 3
  • Python :: 3.10
  • Python :: 3.11
  • Python :: 3.12
  • Python :: 3.13

Topic
  • Scientific/Engineering :: GIS
Documentation Status PyPI Anaconda

Manipulation and analysis of geometric objects in the Cartesian plane.

https://c2.staticflickr.com/6/5560/31301790086_b3472ea4e9_c.jpg

Shapely is a BSD-licensed Python package for manipulation and analysis of planar geometric objects. It is using the widely deployed open-source geometry library GEOS (the engine of PostGIS, and a port of JTS). Shapely wraps GEOS geometries and operations to provide both a feature rich Geometry interface for singular (scalar) geometries and higher-performance NumPy ufuncs for operations using arrays of geometries. Shapely is not primarily focused on data serialization formats or coordinate systems, but can be readily integrated with packages that are.

What is a ufunc?

A universal function (or ufunc for short) is a function that operates on n-dimensional arrays on an element-by-element fashion and supports array broadcasting. The underlying for loops are implemented in C to reduce the overhead of the Python interpreter.

Multithreading

Shapely functions generally support multithreading by releasing the Global Interpreter Lock (GIL) during execution. Normally in Python, the GIL prevents multiple threads from computing at the same time. Shapely functions internally release this constraint so that the heavy lifting done by GEOS can be done in parallel, from a single Python process.

Usage

Here is the canonical example of building an approximately circular patch by buffering a point, using the scalar Geometry interface:

>>> from shapely import Point
>>> patch = Point(0.0, 0.0).buffer(10.0)
>>> patch
<POLYGON ((10 0, 9.952 -0.98, 9.808 -1.951, 9.569 -2.903, 9.239 -3.827, 8.81...>
>>> patch.area
313.6548490545941

Using the vectorized ufunc interface (instead of using a manual for loop), compare an array of points with a polygon:

>>> import shapely
>>> import numpy as np
>>> geoms = np.array([Point(0, 0), Point(1, 1), Point(2, 2)])
>>> polygon = shapely.box(0, 0, 2, 2)

>>> shapely.contains(polygon, geoms)
array([False,  True, False])

See the documentation for more examples and guidance: https://shapely.readthedocs.io

Requirements

Shapely 2.1 requires

  • Python >=3.10

  • GEOS >=3.9

  • NumPy >=1.21

Installing Shapely

We recommend installing Shapely using one of the available built distributions, for example using pip or conda:

$ pip install shapely
# or using conda
$ conda install shapely --channel conda-forge

See the installation documentation for more details and advanced installation instructions.

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.

>>> from shapely.wkt import dumps, loads
>>> dumps(loads('POINT (0 0)'))
'POINT (0.0000000000000000 0.0000000000000000)'

Shapely can also integrate with other Python GIS packages using GeoJSON-like dicts.

>>> import json
>>> from shapely.geometry import mapping, shape
>>> s = shape(json.loads('{"type": "Point", "coordinates": [0.0, 0.0]}'))
>>> s
<POINT (0 0)>
>>> print(json.dumps(mapping(s)))
{"type": "Point", "coordinates": [0.0, 0.0]}

Support

Questions about using Shapely may be asked on the GIS StackExchange using the “shapely” tag.

Bugs may be reported at https://github.com/shapely/shapely/issues.

2.1.1 May 19, 2025
2.1.0 Apr 03, 2025
2.1.0rc1 Mar 15, 2025
2.0.7 Jan 31, 2025
2.0.6 Aug 19, 2024
2.0.5 Jul 13, 2024
2.0.4 Apr 16, 2024
2.0.3 Feb 16, 2024
2.0.2 Oct 12, 2023
2.0.1 Jan 30, 2023
2.0.0 Dec 12, 2022
2.0rc3 Dec 07, 2022
2.0rc2 Dec 03, 2022
2.0rc1 Nov 26, 2022
2.0b2 Oct 29, 2022
2.0b1 Oct 17, 2022
2.0a1 Aug 03, 2022
1.8.5.post1 Oct 13, 2022
1.8.5 Oct 12, 2022
1.8.4 Aug 17, 2022
1.8.3 Aug 17, 2022
1.8.2 May 03, 2022
1.8.1.post1 Feb 18, 2022
1.8.1 Feb 16, 2022
1.8.0 Oct 25, 2021
1.8rc2 Oct 19, 2021
1.8rc1 Oct 04, 2021
1.8a3 Aug 24, 2021
1.8a2 Jul 15, 2021
1.8a1 Mar 04, 2021
1.7.1 Aug 20, 2020
1.7.0 Jan 28, 2020
1.7b1 Jan 13, 2020
1.7a3 Dec 31, 2019
1.7a2 Jun 22, 2019
1.7a1 Jul 29, 2018
1.6.4.post2 Jul 18, 2018
1.6.4.post1 Jan 24, 2018
1.6.4 Jan 24, 2018
1.6.3 Dec 09, 2017
1.6.2.post1 Oct 31, 2017
1.6.2 Oct 26, 2017
1.6.1 Sep 01, 2017
1.6.0 Aug 22, 2017
1.6b5 Aug 18, 2017
1.6b4 Feb 15, 2017
1.6b3 Dec 31, 2016
1.6b2 Dec 12, 2016
1.6b1 Dec 12, 2016
1.6a2 Nov 15, 2016
1.6a1 Sep 14, 2016
1.6.dev0 Jul 11, 2016
1.5.17.post1 Dec 23, 2016
1.5.17 Aug 31, 2016
1.5.16 May 27, 2016
1.5.15 Mar 29, 2016
1.5.14 Mar 28, 2016
1.5.13 Oct 10, 2015
1.5.12 Aug 27, 2015
1.5.11 Aug 23, 2015
1.5.10 Aug 23, 2015
1.5.9 May 28, 2015
1.5.8 Apr 29, 2015
1.5.7 Mar 16, 2015
1.5.6 Feb 04, 2015
1.5.5 Jan 20, 2015
1.5.4 Jan 19, 2015
1.5.3 Jan 13, 2015
1.5.2 Jan 04, 2015
1.5.1 Dec 04, 2014
1.5.0 Dec 02, 2014
1.4.4 Nov 03, 2014
1.4.3 Oct 01, 2014
1.4.2 Sep 29, 2014
1.4.1 Sep 24, 2014
1.4.0 Sep 09, 2014
1.3.3 Jul 23, 2014
1.3.2 May 13, 2014
1.3.1 Apr 22, 2014
1.3.0 Dec 31, 2013
1.2.19 Dec 30, 2013
1.2.18 Jul 23, 2013
1.2.17 Jan 27, 2013
1.2.16 Sep 18, 2012
1.2.15 Jun 28, 2012
1.2.14 Jan 24, 2012
1.2.13 Sep 16, 2011
1.2.12 Aug 15, 2011
1.2.10 May 16, 2011
1.2.9 Apr 01, 2011
1.2.8 Jan 03, 2011
1.2.7 Nov 09, 2010
1.2.6 Oct 21, 2010
1.2.5 Sep 19, 2010
1.2.4 Sep 16, 2010
1.2.3 Aug 19, 2010
1.2.2 Jul 23, 2010
1.2.1 Jun 24, 2010
1.2 May 27, 2010
1.2rc2 May 26, 2010
1.2rc1 May 25, 2010
1.2b7 Apr 22, 2010
1.2b6 Apr 13, 2010
1.2b5 Apr 09, 2010
1.2b4 Mar 19, 2010
1.2b3 Feb 28, 2010
1.2b2 Feb 19, 2010
1.2b1 Feb 18, 2010
1.0.15 Mar 20, 2010
1.0.14 Oct 22, 2009
1.0.13 Oct 02, 2009
1.0.12 Apr 09, 2009
1.0.11 Nov 20, 2008
1.0.7 Aug 23, 2008
1.0.6 Jul 10, 2008
1.0.5 May 20, 2008
1.0.4 May 01, 2008
1.0.3 Apr 09, 2008
1.0.2 Feb 26, 2008
1.0.1 Feb 08, 2008
1.0 Jan 18, 2008
1.0rc2 Jan 16, 2008
1.0rc1 Jan 14, 2008
1.0b4 Jan 04, 2008
1.0b3 Jan 02, 2008
1.0b2 Nov 27, 2007
1.0b1 Nov 20, 2007
1.0a7 Oct 23, 2007
0.0rc0 Oct 23, 2007

Wheel compatibility matrix

Platform CPython 3.10 CPython 3.11 CPython 3.12 CPython 3.13 CPython (additional flags: t) 3.13
macosx_10_13_x86_64
macosx_10_9_x86_64
macosx_11_0_arm64
manylinux2014_aarch64
manylinux2014_x86_64
manylinux_2_17_aarch64
manylinux_2_17_x86_64
musllinux_1_2_aarch64
musllinux_1_2_x86_64
win32
win_amd64

Files in release

shapely-2.1.1-cp310-cp310-macosx_10_9_x86_64.whl (1.7MiB)
shapely-2.1.1-cp310-cp310-macosx_11_0_arm64.whl (1.6MiB)
shapely-2.1.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (2.8MiB)
shapely-2.1.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.9MiB)
shapely-2.1.1-cp310-cp310-musllinux_1_2_aarch64.whl (3.7MiB)
shapely-2.1.1-cp310-cp310-musllinux_1_2_x86_64.whl (3.9MiB)
shapely-2.1.1-cp310-cp310-win32.whl (1.5MiB)
shapely-2.1.1-cp310-cp310-win_amd64.whl (1.6MiB)
shapely-2.1.1-cp311-cp311-macosx_10_9_x86_64.whl (1.7MiB)
shapely-2.1.1-cp311-cp311-macosx_11_0_arm64.whl (1.6MiB)
shapely-2.1.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (2.9MiB)
shapely-2.1.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.0MiB)
shapely-2.1.1-cp311-cp311-musllinux_1_2_aarch64.whl (3.8MiB)
shapely-2.1.1-cp311-cp311-musllinux_1_2_x86_64.whl (3.9MiB)
shapely-2.1.1-cp311-cp311-win32.whl (1.5MiB)
shapely-2.1.1-cp311-cp311-win_amd64.whl (1.6MiB)
shapely-2.1.1-cp312-cp312-macosx_10_13_x86_64.whl (1.7MiB)
shapely-2.1.1-cp312-cp312-macosx_11_0_arm64.whl (1.6MiB)
shapely-2.1.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (2.8MiB)
shapely-2.1.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.0MiB)
shapely-2.1.1-cp312-cp312-musllinux_1_2_aarch64.whl (3.7MiB)
shapely-2.1.1-cp312-cp312-musllinux_1_2_x86_64.whl (3.9MiB)
shapely-2.1.1-cp312-cp312-win32.whl (1.5MiB)
shapely-2.1.1-cp312-cp312-win_amd64.whl (1.6MiB)
shapely-2.1.1-cp313-cp313-macosx_10_13_x86_64.whl (1.7MiB)
shapely-2.1.1-cp313-cp313-macosx_11_0_arm64.whl (1.6MiB)
shapely-2.1.1-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (2.8MiB)
shapely-2.1.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.9MiB)
shapely-2.1.1-cp313-cp313-musllinux_1_2_aarch64.whl (3.7MiB)
shapely-2.1.1-cp313-cp313-musllinux_1_2_x86_64.whl (3.9MiB)
shapely-2.1.1-cp313-cp313-win32.whl (1.5MiB)
shapely-2.1.1-cp313-cp313-win_amd64.whl (1.6MiB)
shapely-2.1.1-cp313-cp313t-macosx_10_13_x86_64.whl (1.7MiB)
shapely-2.1.1-cp313-cp313t-macosx_11_0_arm64.whl (1.6MiB)
shapely-2.1.1-cp313-cp313t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (2.9MiB)
shapely-2.1.1-cp313-cp313t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.0MiB)
shapely-2.1.1-cp313-cp313t-musllinux_1_2_aarch64.whl (3.8MiB)
shapely-2.1.1-cp313-cp313t-musllinux_1_2_x86_64.whl (3.9MiB)
shapely-2.1.1-cp313-cp313t-win32.whl (1.5MiB)
shapely-2.1.1-cp313-cp313t-win_amd64.whl (1.6MiB)
shapely-2.1.1.tar.gz (308.0KiB)
Extras:
Dependencies:
numpy (>=1.21)