Manipulation and analysis of geometric objects
Project description
Manipulation and analysis of geometric objects in the Cartesian plane.
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.0 requires
Python >=3.7
GEOS >=3.5
NumPy >=1.14
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.
Copyright & License
Shapely is licensed under BSD 3-Clause license. GEOS is available under the terms of GNU Lesser General Public License (LGPL) 2.1 at https://libgeos.org.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Hashes for shapely-2.0.3-cp312-cp312-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6f555fe3304a1f40398977789bc4fe3c28a11173196df9ece1e15c5bc75a48db |
|
MD5 | 99062ec3917c8f68f808663479f957f3 |
|
BLAKE2b-256 | 83e615044a86a0d40ae57195ba2153d4078ca6855de3a93fd37542300f632c83 |
Hashes for shapely-2.0.3-cp312-cp312-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 99abad1fd1303b35d991703432c9481e3242b7b3a393c186cfb02373bf604004 |
|
MD5 | 31bc04a44ca308a2efd48e60cfd5c4c7 |
|
BLAKE2b-256 | d8531eb732b5c0eaf866878a4a7194e1d48bcf54b3ca1a0da14757e0a1a09101 |
Hashes for shapely-2.0.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b9f2d93bff2ea52fa93245798cddb479766a18510ea9b93a4fb9755c79474889 |
|
MD5 | 781cddc45741ff2a608d5c8834eca635 |
|
BLAKE2b-256 | 02dcf52a12fc1d20b5f871b58e8751ca1112cea72c487c4b055f6ff86beb5532 |
Hashes for shapely-2.0.3-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 882fb1ffc7577e88c1194f4f1757e277dc484ba096a3b94844319873d14b0f2d |
|
MD5 | 2194ea5fc0998097eb4ca20216953b02 |
|
BLAKE2b-256 | a075992c8baa0636ca9b463be676f7f57dbc4dfc2806bd700fcabd23ad3429d3 |
Hashes for shapely-2.0.3-cp312-cp312-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bd45d456983dc60a42c4db437496d3f08a4201fbf662b69779f535eb969660af |
|
MD5 | 6b119105cdfcdcc0df8a3180fb915844 |
|
BLAKE2b-256 | 26ad81df31ec9e0065614482c54674b8c328627476aaeb61b081bfbd3ed1997f |
Hashes for shapely-2.0.3-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c91981c99ade980fc49e41a544629751a0ccd769f39794ae913e53b07b2f78b9 |
|
MD5 | 13a42a5c979c861adc06a50111baafd5 |
|
BLAKE2b-256 | c4616a0a6170b73b49b66ad596d4745aba7b3b46f84ea6f42c72f0e304186ace |
Hashes for shapely-2.0.3-cp312-cp312-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e86e7cb8e331a4850e0c2a8b2d66dc08d7a7b301b8d1d34a13060e3a5b4b3b55 |
|
MD5 | f8b697458b290529689957ffd28bb46a |
|
BLAKE2b-256 | 272f61a2e13dfdbba6a4610522d90e7eb55062c0f0a66dbd0cf24069d88ab67b |
Hashes for shapely-2.0.3-cp311-cp311-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6b464f2666b13902835f201f50e835f2f153f37741db88f68c7f3b932d3505fa |
|
MD5 | a04c1a612206227932b3f4597ee43cd4 |
|
BLAKE2b-256 | 29cd763817c27e6cb6d04ffd477a5dcdfdd71bc3fb640f5748c9f2c1cd08ba52 |
Hashes for shapely-2.0.3-cp311-cp311-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9302d7011e3e376d25acd30d2d9e70d315d93f03cc748784af19b00988fc30b1 |
|
MD5 | 496e0da2c4bdc8974003874324409948 |
|
BLAKE2b-256 | d09890c2983cd7f30aac6ca2b09072b9222cac1a38e6da3498efb76eceaf7cb4 |
Hashes for shapely-2.0.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 13cb37d3826972a82748a450328fe02a931dcaed10e69a4d83cc20ba021bc85f |
|
MD5 | ce7e862a5ba8a33a9d4aca8e465ea72f |
|
BLAKE2b-256 | 0d8f4d3df127beac22a1fb9bcf9783d75550af805290476a29277c72494dcf73 |
Hashes for shapely-2.0.3-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e45f0c8cd4583647db3216d965d49363e6548c300c23fd7e57ce17a03f824034 |
|
MD5 | f443fa4383f0a187565676e569f54e22 |
|
BLAKE2b-256 | adb18b714f7c405299583bfa283c6246a6d2150a556e5d2626a4cafe1feea84f |
Hashes for shapely-2.0.3-cp311-cp311-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b2a7d256db6f5b4b407dc0c98dd1b2fcf1c9c5814af9416e5498d0a2e4307a4b |
|
MD5 | a33278182fd31a9e44f5f160e582d481 |
|
BLAKE2b-256 | 54f98bb513c90c17dc78b9d1b56fd89d66d397e3fa215cdce0dde845748176b2 |
Hashes for shapely-2.0.3-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 619232c8276fded09527d2a9fd91a7885ff95c0ff9ecd5e3cb1e34fbb676e2ae |
|
MD5 | 31610a99dd6f9d1eee731ef8f38e7d4b |
|
BLAKE2b-256 | 5632dcd564be5060e6083f3cb456f67b80e1a753c94e6c1b9d454b2aafa182c9 |
Hashes for shapely-2.0.3-cp311-cp311-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 56cee3e4e8159d6f2ce32e421445b8e23154fd02a0ac271d6a6c0b266a8e3cce |
|
MD5 | 016de4fc460b00f3405810b04219a5f6 |
|
BLAKE2b-256 | 9f78a13f94f028c80adceeae7b55b1920c884ca0214d0da969712ee60862758f |
Hashes for shapely-2.0.3-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 64c5013dacd2d81b3bb12672098a0b2795c1bf8190cfc2980e380f5ef9d9e4d9 |
|
MD5 | e2a25bb1e8badaa5b072165d6906f8dc |
|
BLAKE2b-256 | cac47e8ab15d64b17dd4c40cc529ce65c0f4fd43ab58b697d1f06a71780a8831 |
Hashes for shapely-2.0.3-cp310-cp310-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6dfdc077a6fcaf74d3eab23a1ace5abc50c8bce56ac7747d25eab582c5a2990e |
|
MD5 | 35ecb16a9ebeada4e8747ecceb0e76c7 |
|
BLAKE2b-256 | 5b8b2dd027ac40a80c97356a1446f1c3102bb7385054739435c3637815523765 |
Hashes for shapely-2.0.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f10d2ccf0554fc0e39fad5886c839e47e207f99fdf09547bc687a2330efda35b |
|
MD5 | cad6cbd5113e7736b70292ce417d0b9d |
|
BLAKE2b-256 | 3ed22afa1e563d417401ac364017a4d4d2d13a9dacb7dcbb83cc13f48a1efe41 |
Hashes for shapely-2.0.3-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 881eb9dbbb4a6419667e91fcb20313bfc1e67f53dbb392c6840ff04793571ed1 |
|
MD5 | 8e0c0c6c3037316fbbc05938e490d985 |
|
BLAKE2b-256 | fc479f19ac74eae72caaddf7c5124fe884aafccc692011029fec579face68391 |
Hashes for shapely-2.0.3-cp310-cp310-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 71eb736ef2843f23473c6e37f6180f90f0a35d740ab284321548edf4e55d9a52 |
|
MD5 | e7f9252da40969d00eb4ce402e2d1e9d |
|
BLAKE2b-256 | d94a3bc9250ce58f513067200d3d4bad6a9ef1800c8824904b56f929e25bbf17 |
Hashes for shapely-2.0.3-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 98040462b36ced9671e266b95c326b97f41290d9d17504a1ee4dc313a7667b9c |
|
MD5 | 2f64d014a1ff1ea73bdb6a6edfbc732a |
|
BLAKE2b-256 | f19710f16e90e8f0e042cc1ec822a913c897f7ed29e80aabaae0648a68a56aad |
Hashes for shapely-2.0.3-cp310-cp310-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | af7e9abe180b189431b0f490638281b43b84a33a960620e6b2e8d3e3458b61a1 |
|
MD5 | 9931043c6a383459d6c16e3069253b0e |
|
BLAKE2b-256 | 264ed18c600230f343cc3ffe538b0d755616688ac4b15e53e40315915d474e7f |
Hashes for shapely-2.0.3-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5026b30433a70911979d390009261b8c4021ff87c7c3cbd825e62bb2ffa181bc |
|
MD5 | 8df55f9b4a966e44716e3c656336be12 |
|
BLAKE2b-256 | 451cbf88b078e6e148ecb4d8e334ab94e01df383ead09d17e6c60fb90b7bbc01 |
Hashes for shapely-2.0.3-cp39-cp39-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 58afbba12c42c6ed44c4270bc0e22f3dadff5656d711b0ad335c315e02d04707 |
|
MD5 | 53fbc416c7418e2c696a70d4accf5bc5 |
|
BLAKE2b-256 | 0b285ab46c9178bbbbc6b7741d334acf8bb477652feabc1fd63166038d5281a0 |
Hashes for shapely-2.0.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 88566d01a30f0453f7d038db46bc83ce125e38e47c5f6bfd4c9c287010e9bf74 |
|
MD5 | 64c734ba2b62ec2d117014b8fc0ea851 |
|
BLAKE2b-256 | a7c6ff0ac1df8d9e806e8c710b08600cd7764f2cf794e6cc5749992298a1c9f2 |
Hashes for shapely-2.0.3-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4d279e56bbb68d218d63f3efc80c819cedcceef0e64efbf058a1df89dc57201b |
|
MD5 | 000a45e8a7068f5e6fcf241433d91ef9 |
|
BLAKE2b-256 | c5c8278e87316ab75053606d9633e66f699003a04d10b55b1a24668970f5e696 |
Hashes for shapely-2.0.3-cp39-cp39-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 71b2de56a9e8c0e5920ae5ddb23b923490557ac50cb0b7fa752761bf4851acde |
|
MD5 | 4bd5dcfafc35854fa7e4b95a9d3bde47 |
|
BLAKE2b-256 | 65948487d3bf8d7f1dff4f35e862bae49d91feaa8f309062fdfc5773b927ba8b |
Hashes for shapely-2.0.3-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 27b6e1910094d93e9627f2664121e0e35613262fc037051680a08270f6058daf |
|
MD5 | 54e029f24342b4e8a7ff19baac4e999d |
|
BLAKE2b-256 | 6854354f08c285e6a50eb61f5a805bcf09f97dbe5ab846404f74614cc36136ee |
Hashes for shapely-2.0.3-cp39-cp39-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 083d026e97b6c1f4a9bd2a9171c7692461092ed5375218170d91705550eecfd5 |
|
MD5 | f4cca1f765bed00e2ca2ec75bdab1faa |
|
BLAKE2b-256 | fe8d795ebf81de47009ef1322608dc62a2c735fbf00dfc3d2ecd3c609ea07346 |
Hashes for shapely-2.0.3-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 300d203b480a4589adefff4c4af0b13919cd6d760ba3cbb1e56275210f96f654 |
|
MD5 | 9c97c17600bbed4770126be5ae68ea12 |
|
BLAKE2b-256 | 56fc6e0090f950d05077afdd8631da45ada05345e3274af74f727a4f05fb0f04 |
Hashes for shapely-2.0.3-cp38-cp38-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 54d925c9a311e4d109ec25f6a54a8bd92cc03481a34ae1a6a92c1fe6729b7e01 |
|
MD5 | d3275807f2a1422bf0be90f22de746af |
|
BLAKE2b-256 | 2182f3caecbaf0dbfc592189d191c5ef78a2d2c9eac67dc355cd826cc1022e18 |
Hashes for shapely-2.0.3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 42bceb9bceb3710a774ce04908fda0f28b291323da2688f928b3f213373b5aee |
|
MD5 | b1050ce7efbc6404cdd78c45efddcca6 |
|
BLAKE2b-256 | ca3cddb0927a108a6a00b38cbaa9958427fcf16d712c01f1db0dc0ff34c8bc1b |
Hashes for shapely-2.0.3-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d8c2a2989222c6062f7a0656e16276c01bb308bc7e5d999e54bf4e294ce62e76 |
|
MD5 | a62303a318f792115b2bb0656676bab2 |
|
BLAKE2b-256 | a95ae87e83ae904c84c994a4044e018cf53ce01c3ee027f99d858a0dfb5cd504 |
Hashes for shapely-2.0.3-cp38-cp38-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f24ecbb90a45c962b3b60d8d9a387272ed50dc010bfe605f1d16dfc94772d8a1 |
|
MD5 | 9311e1c900dc0fa8391121ac11c12e94 |
|
BLAKE2b-256 | bdb5222482f3b95c76f8293c9985a50dcca50712e1d32904b5517fd8a1dbe4a3 |
Hashes for shapely-2.0.3-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 601c5c0058a6192df704cb889439f64994708563f57f99574798721e9777a44b |
|
MD5 | 7ec55978c493365364669b8c88684103 |
|
BLAKE2b-256 | 7674b6677b5f7802d647daadfdd1b6189b143f7f9feed4b68481e7a5e664055f |
Hashes for shapely-2.0.3-cp38-cp38-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 705efbce1950a31a55b1daa9c6ae1c34f1296de71ca8427974ec2f27d57554e3 |
|
MD5 | a120dd4f165877bfadc5e0148f755590 |
|
BLAKE2b-256 | 0b24cbd555617b51c824dbdfea347a5d8f2fc3e6a8e93fc02012ad3c3dfb3caf |
Hashes for shapely-2.0.3-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 59b16976c2473fec85ce65cc9239bef97d4205ab3acead4e6cdcc72aee535679 |
|
MD5 | 3cd79f7d9c42f7467ef8a4d98e55794f |
|
BLAKE2b-256 | 9c01a6c25af34df9a98b9992279ebd773a7fd81235a2e59b5af511d3508bd54e |
Hashes for shapely-2.0.3-cp37-cp37m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 31a40b6e3ab00a4fd3a1d44efb2482278642572b8e0451abdc8e0634b787173e |
|
MD5 | ab10509d20f20172147ac9bc3f1f8ea3 |
|
BLAKE2b-256 | 8b1e6d5c4328d18ca5c04c0ef800ca300e7dc4d2ad895538bbb6d9c86ea1539e |
Hashes for shapely-2.0.3-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 442f4dcf1eb58c5a4e3428d88e988ae153f97ab69a9f24e07bf4af8038536325 |
|
MD5 | 7a59b1a4cf6d003b38567a044ff3235b |
|
BLAKE2b-256 | c2ebad5d24fdc8ea56f3926ab8d86a50732ec74d3c60fefcb94d0dc2b76c6a82 |
Hashes for shapely-2.0.3-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 18bddb8c327f392189a8d5d6b9a858945722d0bb95ccbd6a077b8e8fc4c7890d |
|
MD5 | 7432a7d20f1bfebc7f4cd1a851d5a776 |
|
BLAKE2b-256 | 1898303e18a92d7bd9c62112f6889b08afba9570f4ceefc17d7242213bb6cbfe |
Hashes for shapely-2.0.3-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a983cc418c1fa160b7d797cfef0e0c9f8c6d5871e83eae2c5793fce6a837fad9 |
|
MD5 | f602bd83d8c402247abc6a00f0d1195b |
|
BLAKE2b-256 | 69e0f90d548a3a545e5097488bc92ff8e1d1ecf5c9e4e816d6573a386e8a9a16 |