Skip to main content

GEOS wrapped in numpy ufuncs

Project description

Documentation Status Travis CI status Appveyor CI status PyPI

PyGEOS is a C/Python library with vectorized geometry functions. The geometry operations are done in the open-source geometry library GEOS. PyGEOS wraps these operations in NumPy ufuncs providing a performance improvement when operating on arrays of geometries.

Note: PyGEOS is a very young package. While the available functionality should be stable and working correctly, it’s still possible that APIs change in upcoming releases. But we would love for you to try it out, give feedback or contribute!

What is a ufunc?

A universal function (or ufunc for short) is a function that operates on n-dimensional arrays in an element-by-element fashion, supporting array broadcasting. The for-loops that are involved are fully implemented in C diminishing the overhead of the Python interpreter.

Multithreading

PyGEOS functions support multithreading. More specifically, the Global Interpreter Lock (GIL) is released during function execution. Normally in Python, the GIL prevents multiple threads from computing at the same time. PyGEOS functions internally releases this constraint so that the heavy lifting done by GEOS can be done in parallel, from a single Python process.

The Geometry object

The pygeos.Geometry object is a container of the actual GEOSGeometry object. The Geometry object keeps track of the underlying GEOSGeometry and allows the python garbage collector to free memory when it is not used anymore.

Geometry objects are immutable. This means that after constructed, they cannot be changed inplace. Every PyGEOS operation will result in a new object being returned.

Construct a Geometry from a WKT (Well-Known Text):

>>> from pygeos import Geometry

>>> geometry = Geometry("POINT (5.2 52.1)")

Or using one of the provided (vectorized) functions:

>>> from pygeos import points

>>> point = points([(5.2, 52.1), (5.1, 52.2)]]

Examples

Compare an grid of points with a polygon:

>>> geoms = points(*np.indices((4, 4)))
>>> polygon = box(0, 0, 2, 2)

>>> contains(polygon, geoms)

  array([[False, False, False, False],
         [False,  True, False, False],
         [False, False, False, False],
         [False, False, False, False]])

Compute the area of all possible intersections of two lists of polygons:

>>> from pygeos import box, area, intersection

>>> polygons_x = box(range(5), 0, range(10, 15), 10)
>>> polygons_y = box(0, range(5), 10, range(10, 15))

>>> area(intersection(polygons_x[:, np.newaxis], polygons_y[np.newaxis, :]))

array([[100.,  90.,  80.,  70.,  60.],
     [ 90.,  81.,  72.,  63.,  54.],
     [ 80.,  72.,  64.,  56.,  48.],
     [ 70.,  63.,  56.,  49.,  42.],
     [ 60.,  54.,  48.,  42.,  36.]])

See the documentation for more: https://pygeos.readthedocs.io

Relationship to Shapely

Both Shapely and PyGEOS are exposing the functionality of the GEOS C++ library to Python. While Shapely only deals with single geometries, PyGEOS provides vectorized functions to work with arrays of geometries, giving better performance and convenience for such usecases.

There is active discussion and work toward integrating PyGEOS into Shapely:

For now PyGEOS is developed as a separate project.

References

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pygeos-0.8.tar.gz (74.5 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

pygeos-0.8-cp38-cp38-win_amd64.whl (673.1 kB view details)

Uploaded CPython 3.8Windows x86-64

pygeos-0.8-cp38-cp38-win32.whl (569.0 kB view details)

Uploaded CPython 3.8Windows x86

pygeos-0.8-cp38-cp38-manylinux1_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.8

pygeos-0.8-cp38-cp38-macosx_10_9_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.8macOS 10.9+ x86-64

pygeos-0.8-cp37-cp37m-win_amd64.whl (673.0 kB view details)

Uploaded CPython 3.7mWindows x86-64

pygeos-0.8-cp37-cp37m-win32.whl (568.8 kB view details)

Uploaded CPython 3.7mWindows x86

pygeos-0.8-cp37-cp37m-manylinux1_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.7m

pygeos-0.8-cp37-cp37m-macosx_10_9_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.7mmacOS 10.9+ x86-64

pygeos-0.8-cp36-cp36m-win_amd64.whl (673.0 kB view details)

Uploaded CPython 3.6mWindows x86-64

pygeos-0.8-cp36-cp36m-win32.whl (568.8 kB view details)

Uploaded CPython 3.6mWindows x86

pygeos-0.8-cp36-cp36m-manylinux1_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.6m

pygeos-0.8-cp36-cp36m-macosx_10_9_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.6mmacOS 10.9+ x86-64

pygeos-0.8-cp35-cp35m-win_amd64.whl (673.7 kB view details)

Uploaded CPython 3.5mWindows x86-64

pygeos-0.8-cp35-cp35m-win32.whl (569.2 kB view details)

Uploaded CPython 3.5mWindows x86

pygeos-0.8-cp35-cp35m-manylinux1_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.5m

File details

Details for the file pygeos-0.8.tar.gz.

File metadata

  • Download URL: pygeos-0.8.tar.gz
  • Upload date:
  • Size: 74.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.18.4 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/2.7.17

File hashes

Hashes for pygeos-0.8.tar.gz
Algorithm Hash digest
SHA256 45b7e1aaa5fc9ff53565ef089fb75c53c419ace8cee18385ec1d7c1515c17cbc
MD5 9c3f735465704fda8d40532093b92f03
BLAKE2b-256 013251318748ac7d68bf42df12a3f3d2b686d2c99e33bbc510847fe8be1b3c1e

See more details on using hashes here.

File details

Details for the file pygeos-0.8-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: pygeos-0.8-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 673.1 kB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.0

File hashes

Hashes for pygeos-0.8-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 650e56de79eceb75b216c3c08c6d703680d845395f5ea9fd67201bfa8240f6a0
MD5 ab29f615ea4b4173964f4309d2219bb7
BLAKE2b-256 1502f4c1c0e76467a059280a6b6ca16be66ec93f2254d17952d7d78ca275bc13

See more details on using hashes here.

File details

Details for the file pygeos-0.8-cp38-cp38-win32.whl.

File metadata

  • Download URL: pygeos-0.8-cp38-cp38-win32.whl
  • Upload date:
  • Size: 569.0 kB
  • Tags: CPython 3.8, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.0

File hashes

Hashes for pygeos-0.8-cp38-cp38-win32.whl
Algorithm Hash digest
SHA256 97a16e1ea243ac65176890d642597276c2c413ba8442a8b4f52cbe1b24ba5f68
MD5 eb7df1654d62db7bfb0aaffd356b3453
BLAKE2b-256 009a087ad7a043ee004e4e996478aab48f34da0bc33640817b486a9b0a5df8bf

See more details on using hashes here.

File details

Details for the file pygeos-0.8-cp38-cp38-manylinux1_x86_64.whl.

File metadata

  • Download URL: pygeos-0.8-cp38-cp38-manylinux1_x86_64.whl
  • Upload date:
  • Size: 1.6 MB
  • Tags: CPython 3.8
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/44.1.1 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/2.7.12

File hashes

Hashes for pygeos-0.8-cp38-cp38-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 36e2b60a987b2ce0ce988a334f2afa8925864456dec2c03891af8fd900a89504
MD5 3287d213bf99879e8f3c69b374b4f26d
BLAKE2b-256 203a9a3c6470eb5b62f946c68bf27e3715f589a90ee4e0944a5559dfb83ad40f

See more details on using hashes here.

File details

Details for the file pygeos-0.8-cp38-cp38-macosx_10_9_x86_64.whl.

File metadata

  • Download URL: pygeos-0.8-cp38-cp38-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 1.4 MB
  • Tags: CPython 3.8, macOS 10.9+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.6.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.1

File hashes

Hashes for pygeos-0.8-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 0df97a1cc15fef561c36596f065cac8e05e1b0de08292ad7a07140a5fa6b4015
MD5 2fc21a0b8b3818997856d807bb1130fe
BLAKE2b-256 98738c670019ad7912697085df67ce88e210f565c1b1e1cb6743528c79317e5b

See more details on using hashes here.

File details

Details for the file pygeos-0.8-cp37-cp37m-win_amd64.whl.

File metadata

  • Download URL: pygeos-0.8-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 673.0 kB
  • Tags: CPython 3.7m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.5

File hashes

Hashes for pygeos-0.8-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 c2bcf0aa4ecad93617d35072230ec9215ca6f9537bf75f959cd4084117269369
MD5 6f9fb5d7dec63a1b7f24e6bb4d5de81f
BLAKE2b-256 ab40430e4b210298f3143bd423795d5a89d67dd58172736ff6eb7b91ff2e9a2c

See more details on using hashes here.

File details

Details for the file pygeos-0.8-cp37-cp37m-win32.whl.

File metadata

  • Download URL: pygeos-0.8-cp37-cp37m-win32.whl
  • Upload date:
  • Size: 568.8 kB
  • Tags: CPython 3.7m, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.5

File hashes

Hashes for pygeos-0.8-cp37-cp37m-win32.whl
Algorithm Hash digest
SHA256 914fe40a9da4a4bd280448f173b48e9232aa652d5ff38e23c7039633fe57e92f
MD5 0d48ab8a6eebf7b31289e983ae8d0a34
BLAKE2b-256 1a236f9995ade3107c057a08d3af651373f435be7514eaf3bae702b78064f695

See more details on using hashes here.

File details

Details for the file pygeos-0.8-cp37-cp37m-manylinux1_x86_64.whl.

File metadata

  • Download URL: pygeos-0.8-cp37-cp37m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 1.6 MB
  • Tags: CPython 3.7m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/44.1.1 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/2.7.12

File hashes

Hashes for pygeos-0.8-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 696f2106b7c4a4f33b813cac141cb8483d420d4209f8e1dbde94e5e572cdac16
MD5 5bd3bd2e12452b1284a3983e02e6f938
BLAKE2b-256 8c457dff89c1af72ed5f479a611c353768ef8309bfc1a9f5fe670ccb4be97872

See more details on using hashes here.

File details

Details for the file pygeos-0.8-cp37-cp37m-macosx_10_9_x86_64.whl.

File metadata

  • Download URL: pygeos-0.8-cp37-cp37m-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 1.4 MB
  • Tags: CPython 3.7m, macOS 10.9+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.6.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.6

File hashes

Hashes for pygeos-0.8-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 1e95c79e34abad166824f3e0bf2412c9ea9873fcf51e0cacfb483f8955505aec
MD5 1afafc13939d5675ca0e54163e15202b
BLAKE2b-256 ec9561a6520864f3b05da6364edc3f7952b625e1d487e5cfba03a8d5787c9784

See more details on using hashes here.

File details

Details for the file pygeos-0.8-cp36-cp36m-win_amd64.whl.

File metadata

  • Download URL: pygeos-0.8-cp36-cp36m-win_amd64.whl
  • Upload date:
  • Size: 673.0 kB
  • Tags: CPython 3.6m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.6.8

File hashes

Hashes for pygeos-0.8-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 ff14eff6248b65b46481f06d4141b7b0dd9e3a0a6b9bf10b1a2c0eddccc94ad6
MD5 c0b870c72523b58eef7aa0c8d76182e9
BLAKE2b-256 4db8511990666b10af72d48344f39d32885f5acc180e5d791546656acff477cb

See more details on using hashes here.

File details

Details for the file pygeos-0.8-cp36-cp36m-win32.whl.

File metadata

  • Download URL: pygeos-0.8-cp36-cp36m-win32.whl
  • Upload date:
  • Size: 568.8 kB
  • Tags: CPython 3.6m, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.6.8

File hashes

Hashes for pygeos-0.8-cp36-cp36m-win32.whl
Algorithm Hash digest
SHA256 35b36a819a663a09f8585c6a67fc7c016004769ae08496b6de10b176e7ba61e1
MD5 81a0b0ca3d2c10350c0815ea2e3fb8b2
BLAKE2b-256 30da88fe98edcdd9cb49e8e69b81900ecc3a562d2a6dca309870d8bb59a06ea9

See more details on using hashes here.

File details

Details for the file pygeos-0.8-cp36-cp36m-manylinux1_x86_64.whl.

File metadata

  • Download URL: pygeos-0.8-cp36-cp36m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 1.6 MB
  • Tags: CPython 3.6m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/44.1.1 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/2.7.12

File hashes

Hashes for pygeos-0.8-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 92bae740bc2ccbb9d03f86995e936ff5a6e41b19a9da0499e8985e6e940a7a93
MD5 f05e1bcd829cbbb481dc679e714290a4
BLAKE2b-256 66062cfcf6e90814da1fdb4585534f03a36531f00cbad65f11b417337d69fe60

See more details on using hashes here.

File details

Details for the file pygeos-0.8-cp36-cp36m-macosx_10_9_x86_64.whl.

File metadata

  • Download URL: pygeos-0.8-cp36-cp36m-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 1.4 MB
  • Tags: CPython 3.6m, macOS 10.9+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.6.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.6.8

File hashes

Hashes for pygeos-0.8-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 5294e7c8e732325a1f7d370ba0fea1faabc6d14926fbbb2b67a4ae618ed47ed2
MD5 0e80b27c7b7cb4e43fb0d904e667d75f
BLAKE2b-256 7745af2e06d3267163b947b22ca7c6a16a2a3197d5ec7c6534d95ea740cc23d1

See more details on using hashes here.

File details

Details for the file pygeos-0.8-cp35-cp35m-win_amd64.whl.

File metadata

  • Download URL: pygeos-0.8-cp35-cp35m-win_amd64.whl
  • Upload date:
  • Size: 673.7 kB
  • Tags: CPython 3.5m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/28.8.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.5.4

File hashes

Hashes for pygeos-0.8-cp35-cp35m-win_amd64.whl
Algorithm Hash digest
SHA256 6585a6adaad8ad3ebcf67e7854211fe9a2bc9beb59dc945b60db6ad40a3a9bd6
MD5 d52777e2d8d785feb405901a97ac27d1
BLAKE2b-256 65f9b06214b7bddd3793e7389634b7981bd1ad2ccceb8262701fced9a2136e90

See more details on using hashes here.

File details

Details for the file pygeos-0.8-cp35-cp35m-win32.whl.

File metadata

  • Download URL: pygeos-0.8-cp35-cp35m-win32.whl
  • Upload date:
  • Size: 569.2 kB
  • Tags: CPython 3.5m, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/28.8.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.5.4

File hashes

Hashes for pygeos-0.8-cp35-cp35m-win32.whl
Algorithm Hash digest
SHA256 efb21aa3b01957c21237aaffbecfabc76f6411a9b7c75d359f1b9eb2d7239181
MD5 5d9034ac87c7c2917abf68e5b8509868
BLAKE2b-256 624a7b99544fbfdcd3181d029a853ce44b68307f5b4952f0edc4e11b1a1b0d99

See more details on using hashes here.

File details

Details for the file pygeos-0.8-cp35-cp35m-manylinux1_x86_64.whl.

File metadata

  • Download URL: pygeos-0.8-cp35-cp35m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 1.6 MB
  • Tags: CPython 3.5m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/44.1.1 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/2.7.12

File hashes

Hashes for pygeos-0.8-cp35-cp35m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 e1ecb3d9edf56eb55208f8d9ff0d314926af3b0527e024172f2fe142b046f4ea
MD5 a5715ee1385db435a537b9c72130ff6e
BLAKE2b-256 6a5063447b4c559915801f5f2d62516fb2790209e60041e8816222c816bf893e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page