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.5-cp312-cp312-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 30e8737983c9d954cd17feb49eb169f02f1da49e24e5171122cf2c2b62d65c95 |
|
MD5 | 9991efa5e5a8e3c0590fb288339cc19f |
|
BLAKE2b-256 | d4c3e98e3eb9f06def32b8e2454ab718cafb99149f023dff023e257125132d6e |
Hashes for shapely-2.0.5-cp312-cp312-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3ac7dc1350700c139c956b03d9c3df49a5b34aaf91d024d1510a09717ea39199 |
|
MD5 | 3429e6a5ef2eb6386e1b0f5b3ad695d6 |
|
BLAKE2b-256 | f99c5b68b3cd484065c7d33d83168d2ecfebfeeaa6d88bc9cfd830de2df490ac |
Hashes for shapely-2.0.5-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 21f64e647a025b61b19585d2247137b3a38a35314ea68c66aaf507a1c03ef6fe |
|
MD5 | 0f8825f4cdae1601969568827b8ac2a7 |
|
BLAKE2b-256 | f032b7687654b6e747ceae8f9fa4cc7489a8ebf275c64caf811f949d87e89f5d |
Hashes for shapely-2.0.5-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1b65365cfbf657604e50d15161ffcc68de5cdb22a601bbf7823540ab4918a98d |
|
MD5 | cf5762a818c9950a58e59d46b117a74c |
|
BLAKE2b-256 | a477c05e794a65263deb020d7e25623234975dd96881f9e8cde341810ca683e7 |
Hashes for shapely-2.0.5-cp312-cp312-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2ff9521991ed9e201c2e923da014e766c1aa04771bc93e6fe97c27dcf0d40ace |
|
MD5 | 49d1588ee2fb2aae56a3161e2faf6264 |
|
BLAKE2b-256 | 5de7719f384857c39aa51aa19d09d7cac84aeab1b25a7d0dab62433bf7b419e9 |
Hashes for shapely-2.0.5-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 03bd7b5fa5deb44795cc0a503999d10ae9d8a22df54ae8d4a4cd2e8a93466195 |
|
MD5 | 2d3e8a73371e547648b57ff60461a192 |
|
BLAKE2b-256 | 04df8062f14cb7aa502b8bda358103facedc80b87eec41e3391182655ff40615 |
Hashes for shapely-2.0.5-cp311-cp311-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6c6b78c0007a34ce7144f98b7418800e0a6a5d9a762f2244b00ea560525290c9 |
|
MD5 | e8637ba89e008cd9db32a4225e40c818 |
|
BLAKE2b-256 | ec1b092fff53cbeced411eed2717592e31cadd3e52f0ebaba5f2df3f34913f96 |
Hashes for shapely-2.0.5-cp311-cp311-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 35110e80070d664781ec7955c7de557456b25727a0257b354830abb759bf8311 |
|
MD5 | e5f369de9e0dcc06c2ca1f798ed86574 |
|
BLAKE2b-256 | 7604111f8d42ad50fb60b2fa725c64a6988d2a49ea513c4feb4e02f93dc353bd |
Hashes for shapely-2.0.5-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d5251c28a29012e92de01d2e84f11637eb1d48184ee8f22e2df6c8c578d26760 |
|
MD5 | 7919e42a5447f34baf50d21fceb5e770 |
|
BLAKE2b-256 | eda8c8b0f1a165e161247caf0fc265d61de3c4ea27d7c313c7ebfb1c4f6ddea4 |
Hashes for shapely-2.0.5-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0f8e71bb9a46814019f6644c4e2560a09d44b80100e46e371578f35eaaa9da1c |
|
MD5 | d37cff75f6a251ed4dc9f81894d2f6ce |
|
BLAKE2b-256 | 7e4e4e83b9f3d7f0ce523c92bdf3dfe0292738d8ad2b589971390d6205bc843e |
Hashes for shapely-2.0.5-cp311-cp311-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 93be600cbe2fbaa86c8eb70656369f2f7104cd231f0d6585c7d0aa555d6878b8 |
|
MD5 | 3149824ce1017fe469c15b702c2c59f7 |
|
BLAKE2b-256 | 80686b51b7587547f6bbd0965cf957505a0ebec93510e840572a983003b3a0a9 |
Hashes for shapely-2.0.5-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5bbfb048a74cf273db9091ff3155d373020852805a37dfc846ab71dde4be93ec |
|
MD5 | 40967b918769fdc6768dcbb2734e8422 |
|
BLAKE2b-256 | 293d0d3ab80860cda6afbce9736fa1f091f452092d344fdd4e3c65e5fe7b1111 |
Hashes for shapely-2.0.5-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1e5cb5ee72f1bc7ace737c9ecd30dc174a5295fae412972d3879bac2e82c8fae |
|
MD5 | 891fa49c70345685a2681d429eb51d36 |
|
BLAKE2b-256 | 70a56d171586eb850c7582d2aeab027e1027ace4eb3a6c2e5f05746b8ab039e0 |
Hashes for shapely-2.0.5-cp310-cp310-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9a4492a2b2ccbeaebf181e7310d2dfff4fdd505aef59d6cb0f217607cb042fb3 |
|
MD5 | 824654795212417babb2e74619825483 |
|
BLAKE2b-256 | 79bb965b1dba79a63912f5a9deb183bab4f725d5c2e39c5ede1b36041b9547e8 |
Hashes for shapely-2.0.5-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2e119444bc27ca33e786772b81760f2028d930ac55dafe9bc50ef538b794a8e1 |
|
MD5 | f8be1de0f1d9c5441955516bf8d75320 |
|
BLAKE2b-256 | a0b68cbd3674fdbd235ef9b82e055b884034ae9526a26a119dd4b7636303cd39 |
Hashes for shapely-2.0.5-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 45211276900c4790d6bfc6105cbf1030742da67594ea4161a9ce6812a6721e68 |
|
MD5 | 1601a892ff81e26a1c72610a77c0d398 |
|
BLAKE2b-256 | 8394bd391727c29dd014d4a24b92c54717de202e2aa6a0d9b5e9320215b11683 |
Hashes for shapely-2.0.5-cp310-cp310-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 798090b426142df2c5258779c1d8d5734ec6942f778dab6c6c30cfe7f3bf64ff |
|
MD5 | 94fa05755143b8ae79fccdd86f0584c6 |
|
BLAKE2b-256 | 4bad8a9fe3b987058ff4f4ba8a7d7d19894f9952add4b1ba7649597cbba715d6 |
Hashes for shapely-2.0.5-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 89d34787c44f77a7d37d55ae821f3a784fa33592b9d217a45053a93ade899375 |
|
MD5 | 56160867ebb3add6bd2e351b031adce9 |
|
BLAKE2b-256 | e17a06aafb341a411c594d3f8f2733f2f644814facf0e6e947a829840f562d36 |
Hashes for shapely-2.0.5-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7fed9dbfbcfec2682d9a047b9699db8dcc890dfca857ecba872c42185fc9e64e |
|
MD5 | 82f2c2f7c171053f2c6600e0636c49a7 |
|
BLAKE2b-256 | 5913d0eff813ee57d73ddfc9aca7afeb30a714723a50f068f3839375bfbfc091 |
Hashes for shapely-2.0.5-cp39-cp39-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8203a8b2d44dcb366becbc8c3d553670320e4acf0616c39e218c9561dd738d92 |
|
MD5 | 0e9ef1227f9a797a44cbe0df35f58da4 |
|
BLAKE2b-256 | e244da3de2d85ad45462564245fd3eb98bb1744d69d834baa1feebb2d6329d66 |
Hashes for shapely-2.0.5-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 06efe39beafde3a18a21dde169d32f315c57da962826a6d7d22630025200c5e6 |
|
MD5 | 372e10428b831b8eaa0ca2553fb567c9 |
|
BLAKE2b-256 | 7189bca9176ef4d7cee06c35163d2d973a01fb28d67a51af485dc6b0a39adb86 |
Hashes for shapely-2.0.5-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 89e640c2cd37378480caf2eeda9a51be64201f01f786d127e78eaeff091ec897 |
|
MD5 | d465aae909327730ae8570d9f257a984 |
|
BLAKE2b-256 | c6caf914baceedbf0f5f78b2356e3382ffb8846ddf9cd90e6ec1ed035b35a901 |
Hashes for shapely-2.0.5-cp39-cp39-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4c83a36f12ec8dee2066946d98d4d841ab6512a6ed7eb742e026a64854019b5f |
|
MD5 | 067f7add5e3d8c090f55d94ede3401cf |
|
BLAKE2b-256 | 36cc3f39afc4b83166641e041e6ab526969214b420468c49a71ea03895739ecb |
Hashes for shapely-2.0.5-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7545a39c55cad1562be302d74c74586f79e07b592df8ada56b79a209731c0219 |
|
MD5 | 7882ef4ca376eb74fd767c06112ec944 |
|
BLAKE2b-256 | 807573137095dbb8e35bf34e6d36edf5059f67ec65fcb6ef836b994fd54f3cf5 |
Hashes for shapely-2.0.5-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4461509afdb15051e73ab178fae79974387f39c47ab635a7330d7fee02c68a3f |
|
MD5 | 471dd28c23cc24c7c5c0d72c7abb0514 |
|
BLAKE2b-256 | a660a2c3b436d794d923a6d8e045690860f894e5671277044f271dc5c5f19ceb |
Hashes for shapely-2.0.5-cp38-cp38-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7e8cf5c252fac1ea51b3162be2ec3faddedc82c256a1160fc0e8ddbec81b06d2 |
|
MD5 | f2762e42d40d040435aa3aff12eec3af |
|
BLAKE2b-256 | fe879f01fb8cf71f1b33a73023dbb0e73500dfc30f483973b24a1c9ac7aeccda |
Hashes for shapely-2.0.5-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b714a840402cde66fd7b663bb08cacb7211fa4412ea2a209688f671e0d0631fd |
|
MD5 | 66f7877e490637a00c9ea62589265d3b |
|
BLAKE2b-256 | 5c99735944b99e32d3103f8c0880925a3fcfe8b04cfff61ad70fe1aac8c22120 |
Hashes for shapely-2.0.5-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f5456dd522800306ba3faef77c5ba847ec30a0bd73ab087a25e0acdd4db2514f |
|
MD5 | ad3f571060d41e8d365b82b13a92f67a |
|
BLAKE2b-256 | 4b37c25a8e47a945b6d22093cd376d695ef82813a06742d5d0f3626d76dcc70f |
Hashes for shapely-2.0.5-cp38-cp38-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8af6f7260f809c0862741ad08b1b89cb60c130ae30efab62320bbf4ee9cc71fa |
|
MD5 | 82750c4a3952344fccc8e27e8e195a8d |
|
BLAKE2b-256 | 135611150c625bc984e9395913a255f52cf6c7de85b98396339cee66119481d4 |
Hashes for shapely-2.0.5-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e91ee179af539100eb520281ba5394919067c6b51824e6ab132ad4b3b3e76dd0 |
|
MD5 | 130c74c632f4f9e59d12e10829dc61db |
|
BLAKE2b-256 | 5e87f1bb954978de7c1dcf575b7710141b9fe07ffbb1b963ea9a96c1a4ef0b7b |
Hashes for shapely-2.0.5-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 401cb794c5067598f50518e5a997e270cd7642c4992645479b915c503866abed |
|
MD5 | 02c4def6713e957af55195a3c80eefc3 |
|
BLAKE2b-256 | 73d4b5ab353c3bf5b3a3f58fe204e1144183ff832932d4bbc37b5a0330ae77a7 |
Hashes for shapely-2.0.5-cp37-cp37m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b5870633f8e684bf6d1ae4df527ddcb6f3895f7b12bced5c13266ac04f47d231 |
|
MD5 | 53d9198278f7d89490949647fa37585f |
|
BLAKE2b-256 | 57d769f4ec187b68e4d0e0bf5b0505ad19a9a69a330d21da8a2b5b38235c3c40 |
Hashes for shapely-2.0.5-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 49b299b91557b04acb75e9732645428470825061f871a2edc36b9417d66c1fc5 |
|
MD5 | 99d6467a4fbf5ac27347e32a61409472 |
|
BLAKE2b-256 | e85e9203579b42060669eaa0715bc2b1e722fd5fe90a8e427851667e905812d7 |
Hashes for shapely-2.0.5-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ff9e520af0c5a578e174bca3c18713cd47a6c6a15b6cf1f50ac17dc8bb8db6a2 |
|
MD5 | 089b251801715020e946ec2a83102191 |
|
BLAKE2b-256 | fbcbce0f406565b230674f7ca56d17b87546b34bf490aa56093ad2063b6205e1 |
Hashes for shapely-2.0.5-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ff7731fea5face9ec08a861ed351734a79475631b7540ceb0b66fb9732a5f529 |
|
MD5 | 12614cfebd6fe06814d60bf7c2d57bc6 |
|
BLAKE2b-256 | f82bb25546f075c3b8f9b8dfdb9408cf418a80e8dab759e560cc810189487ff2 |