Skip to content

pygeos/pygeos

Repository files navigation

PyGEOS

Important note: PyGEOS was merged with Shapely (https://shapely.readthedocs.io) in December 2021 and has been released as part of Shapely 2.0. The development now takes place at the Shapely repository. Please raise issues or create pull request over there. PyGEOS itself will in principle not receive updates anymore.

Documentation Status

Github Actions status

Travis CI status

PyPI

Anaconda

Zenodo

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.

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.

Examples

Compare an grid of points with a polygon:

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

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

References

PyGEOS is licensed under BSD 3-Clause license. Copyright (c) 2019, Casper van der Wel. GEOS is available under the terms of ​GNU Lesser General Public License (LGPL) 2.1 at https://libgeos.org.