github upstream
 
 
 
 
 
Go to file
Casper van der Wel f0e3c789e3 RLS: 0.13 2022-08-25 18:28:12 +02:00
.github/workflows CI: upgrade GEOS patch versions for tests, use GEOS 3.10.3 for release (#454) 2022-08-11 08:49:29 +02:00
benchmarks Add box ufunc based on create_box C function (#308) 2021-03-16 16:56:41 -07:00
ci Update GEOS url (#435) 2021-11-19 13:41:22 +01:00
docker CI: upgrade GEOS patch versions for tests, use GEOS 3.10.3 for release (#454) 2022-08-11 08:49:29 +02:00
docs [Done] assert_geometries_equal (#401) 2021-10-23 10:48:19 +02:00
pygeos Fix to/from_shapely for compat with shapely 2 (#452) 2022-08-17 08:23:36 +02:00
src Fix to/from_shapely for compat with shapely 2 (#452) 2022-08-17 08:23:36 +02:00
.clang-format Format C code using clang-format with Google style (#203) 2020-10-01 19:51:07 +02:00
.dockerignore Memory leak testing using valgrind (#159) 2020-07-09 21:55:34 +02:00
.gitattributes Setup versioneer 2019-09-14 09:49:33 +02:00
.gitignore Build wheels on CI with cibuildwheel (#365) 2021-08-19 11:53:53 +02:00
.pre-commit-config.yaml CI: update black version (#453) 2022-08-08 09:55:14 +02:00
.readthedocs.yml Fix requires_geos with methods (#376) 2021-08-22 13:44:07 +02:00
.travis.yml CI: upgrade GEOS patch versions for tests, use GEOS 3.10.3 for release (#454) 2022-08-11 08:49:29 +02:00
CHANGELOG.rst Release notes for 0.13 (#455) 2022-08-25 18:27:30 +02:00
LICENSE Add LICENSE 2019-09-09 21:32:37 +02:00
MANIFEST.in Build wheels on CI with cibuildwheel (#365) 2021-08-19 11:53:53 +02:00
README.rst Adjust readme (#446) 2021-12-03 16:10:49 +01:00
asv.conf.json Update ASV configuration (#285) 2021-01-27 08:29:08 +01:00
pyproject.toml [Done] OSX arm64 and universal2 wheels (#427) 2021-11-12 19:02:37 +01:00
setup.cfg Explode polygons into rings: get_rings (#342) 2021-05-11 09:35:00 +02:00
setup.py [Done] Write docs for runtime library finding + clean CI runners (#387) 2021-09-21 09:42:05 +02:00
versioneer.py Setup versioneer 2019-09-14 09:49:33 +02:00

README.rst

This file contains invisible Unicode characters!

This file contains invisible Unicode characters that may be processed differently from what appears below. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to reveal hidden characters.

======
PyGEOS
======

.. Documentation at RTD — https://readthedocs.org

.. image:: https://readthedocs.org/projects/pygeos/badge/?version=latest
	:alt: Documentation Status
	:target: https://pygeos.readthedocs.io/en/latest/?badge=latest

.. Github Actions status — https://github.com/pygeos/pygeos/actions

.. image:: https://github.com/pygeos/pygeos/workflows/Test/badge.svg
	:alt: Github Actions status
	:target: https://github.com/pygeos/pygeos/actions/workflows/test-pip.yml?query=branch%3Amaster

.. Travis CI status -- https://travis-ci.com

.. image:: https://travis-ci.com/pygeos/pygeos.svg?branch=master
   :alt: Travis CI status
   :target: https://travis-ci.com/github/pygeos/pygeos

.. PyPI

.. image:: https://img.shields.io/pypi/v/pygeos.svg
	:alt: PyPI
	:target: https://pypi.org/project/pygeos/

.. Anaconda

.. image:: https://img.shields.io/conda/vn/conda-forge/pygeos
  :alt: Anaconda
  :target: https://anaconda.org/conda-forge/pygeos

.. Zenodo

.. image:: https://zenodo.org/badge/191151963.svg
  :alt: Zenodo 
  :target: https://zenodo.org/badge/latestdoi/191151963


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.

**Important note**: PyGEOS was merged with Shapely (https://shapely.readthedocs.io)
in December 2021 and will be released as part of Shapely 2.0. The development will take place
at the Shapely repository. Please raise issues or create pull request over there.
PyGEOS itself will receive updates (by backporting from the Shapely repository) until
Shapely 2.0 is actually released.

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:

.. code:: python

  >>> 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:

.. code:: python

  >>> 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


References
----------

- GEOS: https://libgeos.org
- Shapely: https://shapely.readthedocs.io/en/latest/
- Numpy ufuncs: https://docs.scipy.org/doc/numpy/reference/ufuncs.html
- Joris van den Bossche's blogpost: https://jorisvandenbossche.github.io/blog/2017/09/19/geopandas-cython/
- Matthew Rocklin's blogpost: http://matthewrocklin.com/blog/work/2017/09/21/accelerating-geopandas-1


Copyright & License
-------------------

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.