Registry / storage / geobuf

geobuf

JSON →
library2.0.1pypypi✓ verified 87d ago

Geobuf is a compact binary geospatial format for lossless compression of GeoJSON. Version 2.0.1 is available on PyPI, with infrequent releases.

pip install geobuf
INSTALL
IMPORT
SIG · GEOBUF
G
geobuf
storagepythonv2.0.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Encoder
✓ from geobuf import Encoder
✗ from geobuf.encoder import Encoder
Incorrect submodule; Encoder is directly exposed at package level
Decoder
✓ from geobuf import Decoder
✗ from geobuf.decoder import Decoder
Incorrect submodule; Decoder is directly exposed at package level

Encode a GeoJSON object to Geobuf binary and decode it back to a dictionary.

import geojson from geobuf import Encoder, Decoder # Sample GeoJSON feature feature = geojson.Feature(geometry=geojson.Point((-3.68, 40.41)), properties={"name": "Madrid"}) # Encode to Geobuf bytes encoded = Encoder().encode(feature) print(f"Encoded length: {len(encoded)} bytes") # Decode back to dict (not GeoJSON object) decoded = Decoder().decode(encoded) print(decoded)
Debug
Known issues
breakingGeobuf 2.x changed the wire format and the encoder/decoder API. Data encoded with 1.x cannot be decoded with 2.x and vice versa.
fix
Ensure both encoder and decoder use the same major version. Re-encode any persistent data when upgrading.
affects: 1.x vs 2.x
gotchaThe `decode` method returns a plain Python dictionary, not a GeoJSON or Shapely geometry object. You must convert it yourself if needed.
fix
After decoding, use a library like `geojson` or `shapely.geometry.shape` to reconstruct GeoJSON objects.
affects: all
gotchaGeobuf only supports standard GeoJSON input (e.g., Feature, FeatureCollection, Geometry). Non-standard properties or nested objects may raise errors or be silently dropped.
fix
Validate input is valid GeoJSON before encoding.
affects: all
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'geobuf.encoder'
Importing from submodule that doesn't exist in version 2.x.
fix
Use `from geobuf import Encoder` instead.
AttributeError: 'dict' object has no attribute 'geometry'
Decoder returns a dict, not a GeoJSON object. Code assumes a GeoJSON-like object.
fix
Access dictionary keys directly or convert to GeoJSON using `geojson.Feature(decoded)` if needed.
Upgrade
Version history
2.0.1latest on PyPI · released Jan 20, 2026
Audit
Dependencies

No dependency data recorded yet.

Agent activity
28 hits · last 30 days
node
26
Resources
geobuf — pip install geobuf · libregistry