{"id":10097,"library":"pygeos","title":"PyGEOS","description":"PyGEOS provides GEOS (Geometry Engine - Open Source) operations wrapped in NumPy ufuncs for vectorized geospatial operations. Its development has ceased, and its core functionality has been merged into Shapely starting with version 2.0. The last release is 0.14, and no further major releases are expected as users are encouraged to migrate to Shapely 2.x.","status":"deprecated","version":"0.14","language":"en","source_language":"en","source_url":"https://github.com/pygeos/pygeos","tags":["gis","geospatial","geometry","numpy","shapely","vectorized"],"install":[{"cmd":"pip install pygeos","lang":"bash","label":"Install PyPI package"}],"dependencies":[{"reason":"Core dependency for vectorized operations and ufuncs.","package":"numpy"},{"reason":"Required GEOS C library (>= 3.5.0) for core geometry operations. Not a Python package, needs system installation.","package":"geos","optional":false}],"imports":[{"symbol":"pygeos","correct":"import pygeos"}],"quickstart":{"code":"import pygeos\n\n# Create a single point\npoint_a = pygeos.points(0, 0)\n\n# Create an array of points\npoints_array = pygeos.points([\n    [1, 1],\n    [2, 2],\n    [3, 3]\n])\n\n# Create a polygon\npolygon = pygeos.polygons([(0, 0), (0, 4), (4, 4), (4, 0), (0, 0)])\n\n# Perform a spatial operation: check intersection\nintersects = pygeos.intersects(polygon, points_array)\n\nprint(f\"Point A: {point_a}\")\nprint(f\"Points array: {points_array}\")\nprint(f\"Polygon: {polygon}\")\nprint(f\"Intersects with polygon: {intersects}\") # Expected: [True, True, True]","lang":"python","description":"Demonstrates creating basic geometry objects (points, polygon) and performing a vectorized spatial operation (intersects)."},"warnings":[{"fix":"For new projects, use `shapely` (install `pip install shapely`). For existing projects, refer to the Shapely 2.0 migration guide for `pygeos` users (e.g., `shapely.from_pygeos()`, `shapely.to_pygeos()`).","message":"PyGEOS is officially deprecated as its core functionality has been merged into Shapely 2.0+. No new major features or releases are expected. New projects should use Shapely 2.x, and existing projects should plan to migrate.","severity":"breaking","affected_versions":"All versions, especially relevant since Shapely 2.0+"},{"fix":"Install GEOS via your system's package manager (e.g., `sudo apt-get install libgeos-dev` on Ubuntu, `brew install geos` on macOS) or through a package manager like Conda (`conda install -c conda-forge pygeos`).","message":"PyGEOS requires the GEOS C library (>= 3.5.0, preferably >= 3.6.0 for full features) to be installed on your system. `pip install pygeos` only installs the Python bindings, not the underlying C library. Failure to install GEOS will result in runtime errors.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Convert geometries between the libraries using `pygeos.from_shapely()` or `shapely.to_pygeos()` when necessary. For a unified approach, migrate to Shapely 2.x, which uses the same internal geometry representation.","message":"PyGEOS objects are distinct from Shapely 1.x objects. Direct interoperation between them without explicit conversion methods (e.g., `pygeos.from_shapely`, `shapely.to_pygeos`) can lead to `TypeError` or unexpected behavior.","severity":"gotcha","affected_versions":"All versions when interoperating with Shapely < 2.0"},{"fix":"Always pass NumPy arrays of geometries or coordinate arrays directly to `pygeos` functions for best performance. For example, `pygeos.area(geometry_array)` instead of `[pygeos.area(g) for g in geometry_list]`.","message":"Optimal performance in PyGEOS is achieved by leveraging its vectorized ufuncs, which expect NumPy arrays of geometries or coordinates as input. Iterating over scalar PyGEOS geometries in Python loops negates much of the performance benefit.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-17T00:00:00.000Z","next_check":"2026-07-16T00:00:00.000Z","problems":[{"fix":"Run `pip install pygeos`.","cause":"The 'pygeos' Python package is not installed in the active virtual environment.","error":"ModuleNotFoundError: No module named 'pygeos'"},{"fix":"Install the GEOS C library using your system's package manager (e.g., `sudo apt-get install libgeos-dev` on Debian/Ubuntu, `brew install geos` on macOS, or `conda install -c conda-forge pygeos` if using Anaconda/Miniconda).","cause":"The underlying GEOS C library, essential for PyGEOS functionality, is not installed on the system or is not discoverable by Python.","error":"pygeos.GEOSException: Could not find GEOS shared library"},{"fix":"Ensure all geometry inputs to `pygeos` functions are `pygeos` geometry objects. If working with Shapely 1.x, convert geometries using `pygeos.from_shapely()` before passing them to `pygeos` functions. Consider migrating to Shapely 2.x for unified geometry handling.","cause":"Attempting to use a PyGEOS ufunc with incompatible input types, often by mixing `pygeos` geometries with `shapely` 1.x geometries or other non-geometry types without conversion.","error":"TypeError: ufunc 'contains' not supported for the input types"}]}