pygeoif
A basic implementation of the __geo_interface__
What it is and what it does
PyGeoIf is a minimal, pure-Python library for constructing and manipulating geospatial geometries. It implements the __geo_interface__ protocol—a GeoJSON-like standard used by many GIS libraries—allowing you to create Points, LineStrings, Polygons, and their multi- and collection variants, then read and write them in WKT (Well Known Text) format or convert them to GeoJSON-compatible dictionaries.
The package is designed as a lightweight alternative to Shapely, with no dependencies outside the Python standard library (only typing_extensions at runtime). It supports basic geometric operations like computing bounds, convex hulls, and polygon orientation. It also provides Hypothesis strategies for property-based testing. PyGeoIf is tested on CPython, PyPy, and GraalPy, and was originally written to supply clean, Python-only geometries for the fastkml library.
Use it for:
- Parse and construct GeoJSON-compatible geometry objects without heavy dependencies
- Convert between WKT and Python geometry representations in lightweight applications
- Build geospatial libraries that need a standard __geo_interface__ protocol foundation
- Generate test geometries using Hypothesis strategies for property-based GIS testing
- Embed geometry handling in projects where Shapely's size or compiled dependencies are prohibitive
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
PyGeoIf provides lightweight, pure-Python geometry classes that implement the GeoJSON-like __geo_interface__ protocol for working with geospatial vector data like points, lines, polygons, and their collections.
Yes, if you need lightweight GeoJSON-compatible geometry handling without Shapely's compiled dependencies. The active maintenance, copyleft license clarity, and zero external dependencies make it a solid choice for minimal GIS work or as a foundation for custom geospatial libraries. Not suitable if you need advanced spatial operations—use Shapely for that.
Install
pygeoif on PyPI
pip
pip install pygeoifuv
uv add pygeoifpoetry
poetry add pygeoifInstalling pygeoif
Before you install
Installation is straightforward with low friction: the package is a pure-Python wheel with only typing_extensions as a runtime dependency. Maintenance is active with recent commits and stable production status.
License in practice
PyGeoIf is licensed under LGPL (copyleft), which requires that derivative works and modifications remain under the same or compatible license. Proprietary projects using it must either comply with copyleft terms or seek alternative licensing.
Quickstart
pip install pygeoif
from pygeoif import geometry
p = geometry.Point(1, 1)
print(p.__geo_interface__) # {'type': 'Point', 'bbox': (1, 1, 1, 1), 'coordinates': (1, 1)}
l = geometry.LineString([(0.0, 0.0), (1.0, 1.0)])
print(l.bounds) # (0.0, 0.0, 1.0, 1.0)
Verify before relying
- Performance characteristics compared to Shapely for large geometry datasets
- Whether convex_hull and other operations scale adequately for production GIS workloads
- Interoperability guarantees with other GIS libraries beyond the __geo_interface__ protocol
Package facts
| License | LGPL (copyleft) |
| Python support | supports the current Python release (>=3.9) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — typing_extensions |
| Maintenance | actively maintained — 317 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 370,286/month — #7,180 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: pygeoif-1.6.0-py3-none-any.whl
Keywords: GIS, Hypothesis, Spatial, WKT
Tags
More GIS packages
Shapely provides Python tools for creating,…
permissive · top 1,000 on PyPI
pyprojpyproj provides a Python interface to PROJ,…
permissive · top 1,000 on PyPI
geopandasGeoPandas extends pandas DataFrames to handle…
permissive · top 1,000 on PyPI
geopygeopy is a Python client for geocoding and…
permissive · top 5,000 on PyPI
pyogrioPyogrio provides fast, bulk-oriented read and…
permissive · top 5,000 on PyPI
h3h3 provides Python bindings to Uber's H3…
permissive · top 5,000 on PyPI
geojsonEncodes, decodes, and represents GeoJSON…
permissive · top 5,000 on PyPI
pygeofilterParses OGC filtering standards (CQL, CQL JSON,…
permissive · top 15,000 on PyPI
pygeosPyGEOS wraps GEOS geometry operations in NumPy…
permissive · top 15,000 on PyPI
pyshpPyShp reads and writes ESRI Shapefiles in pure…
permissive · top 5,000 on PyPI
osm2geojsonConverts OpenStreetMap and Overpass API data…
permissive · top 15,000 on PyPI
pydantic-geojsonProvides Pydantic-based type-safe validation…
permissive · top 15,000 on PyPI
plpygisConverts geometries between WKB/EWKB, WKT/EWKT,…
copyleft · top 15,000 on PyPI
fionaFiona reads and writes vector GIS data…
permissive · top 5,000 on PyPI
cligjProvides reusable Click command-line argument…
permissive · top 5,000 on PyPI