Registry / serialization / geomet

geomet

JSON →
library1.1.0pypypi✓ verified 26d ago

geomet is a pure Python library designed for converting between various common geospatial data formats, including Well-Known Text (WKT), Well-Known Binary (WKB), GeoJSON, and EsriJSON. The current version is 1.1.0, with releases occurring a few times a year, primarily for compatibility updates and bug fixes.

pip install geomet
INSTALL
IMPORT
SIG · GEOMET
G
geomet
serializationpythonv1.1.0
Install
1.7s avg
Import
10ms
Disk
17MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.1.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.002s · 18.8MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.7s · import 0.002s · 19MB
17MB installed
● package 17MB
Code
Verified usage

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

wkt
from geomet import wkt
geojson
from geomet import geojson
esrijson
from geomet import esrijson
from geomet import esri
The EsriJSON module is named `esrijson`, not `esri`.

This example demonstrates converting a WKT string into a GeoJSON dictionary and then dumping it back into a GeoJSON string using the `wkt` and `geojson` modules.

from geomet import wkt, geojson wkt_string = "POINT (30 10)" # Convert WKT to GeoJSON dictionary geom_dict = wkt.loads(wkt_string) print(f"WKT loaded as: {geom_dict}") # Expected: {'type': 'Point', 'coordinates': (30.0, 10.0)} # Convert GeoJSON dictionary back to GeoJSON string json_string = geojson.dumps(geom_dict) print(f"GeoJSON dumped as: {json_string}") # Expected: {"type": "Point", "coordinates": [30.0, 10.0]}
Debug
Known issues
breakingSupport for Python 2.7, 3.4, 3.5, and 3.6 was dropped in version 1.0.0. Users on these older Python versions must use `geomet<1.0.0`.
fix
Upgrade your Python environment to 3.7 or newer to use `geomet>=1.0.0`. Alternatively, pin `geomet` to an older version if Python upgrade is not possible.
affects: <1.0.0
gotchaConversions involving EsriJSON, especially with coordinate value structures or custom SRIDs, had known bugs in versions prior to 1.1.0.
fix
Upgrade to `geomet>=1.1.0` to ensure correct and reliable GeoJSON to EsriJSON conversions, including proper handling of coordinate arrays and SRIDs.
affects: <1.1.0
gotchaPrevious versions of `geomet` (specifically before 1.0.0) had issues with handling floating point representation, particularly with exponential coordinate values, which could lead to subtle precision errors during WKT/WKB parsing and generation.
fix
Upgrade to `geomet>=1.0.0` for improved precision and robust handling of floating-point numbers in geospatial data conversions. If on older versions, carefully validate converted geometries.
affects: <1.0.0
breakingThe 'geojson' module was removed from the top-level 'geomet' package import structure starting from version 1.0.0. Direct imports like `from geomet import geojson` will fail with an `ImportError`.
fix
Update import statements. For encoding functionality, use `from geomet.encode import geojson`. For decoding functionality, use `from geomet.decode import geojson`.
affects: >=1.0.0
breakingThe `geomet.geojson` and `geomet.wkb` submodules were removed in version 1.0.0. Attempting to import them (e.g., `from geomet import geojson`) will result in an `ImportError`.
fix
Update import statements. Instead of `from geomet import geojson`, import the `geojson` library directly (e.g., `import geojson`). For conversion functions, consider using `geomet.util` or external libraries directly.
affects: >=1.0.0
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'geomet'
The 'geomet' package is not installed in your Python environment.
fix
pip install geomet
ValueError: Empty geometries cannot be represented in WKB.
You are attempting to convert a GeoJSON object representing an empty geometry (e.g., {'type': 'Point', 'coordinates': []}) to Well-Known Binary (WKB) format, which does not support ambiguous dimensionality for empty geometries.
fix
Ensure that the GeoJSON object contains valid coordinates for its geometry type before converting it to WKB, or handle empty geometries by filtering them out or converting them to a non-binary format.
ValueError: Malformed WKT string
The input string provided to a `geomet.wkt.loads()` function is not a syntactically valid Well-Known Text (WKT) representation of a geometry.
fix
Review and correct the WKT string to strictly adhere to the OGC Simple Feature Access specification. Common issues include missing parentheses, incorrect coordinate formats, or invalid geometry types.
AttributeError: module 'geomet' has no attribute 'loads'
You are trying to call a conversion function like 'loads' directly from the top-level 'geomet' module, but these functions reside within specific submodules (e.g., 'wkt' for WKT, 'geojson' for GeoJSON).
fix
Import the specific submodule for the desired format (e.g., `from geomet import wkt` or `from geomet import geojson`) and then call the function from that submodule (e.g., `wkt.loads(...)` or `geojson.loads(...)`).
Upgrade
Version history
1.1.0latest on PyPI · released Nov 14, 2023
Audit
Dependencies

No dependency data recorded yet.

Agent activity
9 hits · last 30 days
node
6
Amazon
2
Resources
geomet — pip install geomet · libregistry