skillfed

pygeoif

A basic implementation of the __geo_interface__

pygeoif v1.6.0 370.3K downloads/30d#7,180 on PyPI72
Copyleft license LGPL Active released

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 pygeoif

uv

uv add pygeoif

poetry

poetry add pygeoif

Installing 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

Development Status :: 5 - Production/StableFramework :: HypothesisIntended Audience :: DevelopersLicense :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)Operating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: GraalPyProgramming Language :: Python :: Implementation :: PyPyTopic :: Scientific/Engineering :: GISTyping :: Typed

Tags

geojson geometry classes pythonwkt well known text parsinggis vector data lightweightshapely alternative minimalgeospatial protocol implementationpolygon point linestring pythonfeature geometry collections
gis-geometrygeojson-protocolpure-python

More GIS packages