Registry / gcp / odc-geo

odc-geo

JSON →
library0.5.1pypypi✓ verified 84d ago

odc-geo provides geometry classes and operations for geospatial data, built on top of Shapely, Rasterio, and Xarray. It is part of the Open Data Cube ecosystem. Version 0.5.1 released 2025-04-27. Release cadence: irregular, major changes every few months.

pip install odc-geo
INSTALL
IMPORT
SIG · ODC-GEO
O
odc-geo
gcppythonv0.5.1
Install
9.1s avg
Import
566ms
Disk
216MB
Pass rate
9/ 10
Env Coverage9 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.5.1 · 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
glibc
py 3.10
✓ —
✓ 10.6s
py 3.11
✓ —
✓ 9.4s
py 3.12
✓ —
✓ 9.6s
py 3.13
✓ —
✓ 9.9s
py 3.9
✕ build_error
✓ 6.1s
216MB installed
● package 216MB
Code
Verified usage

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

GeoBox
from odc.geo import GeoBox
Correct import path
Geometry
from odc.geo import Geometry
Correct import path
BoundingBox
from odc.geo import BoundingBox
Correct import path
CRS
from odc.geo.crs import CRS
Avoid importing from odc.geo.crs unless specifically needed for CRS operations
odc.geo.xr
from odc.geo import xr_zeros
xr_zeros is a top-level function, not submodule

Create a GeoBox from bounding box, generate a zero-filled DataArray, and reproject.

from odc.geo import GeoBox, CRS from odc.geo.xr import xr_zeros import os # Define a GeoBox crs = CRS('EPSG:4326') geobox = GeoBox.from_bbox((-10, 10, 10, -10), crs=crs, resolution=0.1) print(geobox) # Create an xarray DataArray with geospatial info da = xr_zeros(geobox) print(da) # Basic reproject (if dask available) if 'PYTEST_CURRENT_TEST' not in os.environ: da_reproj = da.odc.reproject('EPSG:3857', resolution=100) print(da_reproj)
Debug
Known issues
breakingIn v0.5.0, xarray became a required dependency. Code that previously imported odc.geo without xarray installed will break.
fix
Ensure xarray is installed: pip install xarray
affects: >=0.5.0
gotchaGeoBox dimensions order is (height, width), not (width, height). Using incorrect order leads to swapped axes.
fix
Always specify shape as (height, width) when constructing GeoBox.
affects: all
deprecatedImporting from odc.geo._deprecated or using legacy functions like `odc.geo.geom.polygon` is deprecated and may be removed in future.
fix
Use the public API: from odc.geo import Geometry instead.
affects: <=0.5.1
breakingodc.geo.crs.CRS was changed: the constructor now enforces stricter validation of EPSG codes. Invalid codes raise an error instead of silently using WGS84.
fix
Ensure EPSG codes are valid integer or string (e.g., 'EPSG:4326'). Use CRS('EPSG:4326') not CRS(4326) (though the latter may still work).
affects: >=0.4.0
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'odc.geo'
odc-geo is not installed or installed in a different environment.
fix
Run: pip install odc-geo
ImportError: cannot import name 'GeoBox' from 'odc.geo'
An outdated version (<0.4.0) where GeoBox was not in the public API or path changed.
fix
Upgrade: pip install --upgrade odc-geo. Use correct import: from odc.geo import GeoBox
TypeError: 'NoneType' object is not subscriptable when accessing .shape
GeoBox shape was not set or is None; often from missing resolution in from_bbox.
fix
Ensure you provide resolution or shape when creating GeoBox. Example: GeoBox.from_bbox(bbox, crs=crs, resolution=0.1)
ValueError: Expected 'shapely' >=2.0, found version ...
odc-geo requires Shapely 2.0+; older versions are incompatible.
fix
Upgrade Shapely: pip install --upgrade shapely
Upgrade
Version history
0.5.1latest on PyPI · released Mar 10, 2026
Audit
Dependencies
xarrayrequiredRequired for xarray integration (was optional before v0.5.0)
shapelyrequiredCore dependency for geometry operations
rasteriorequiredUsed for CRS and raster I/O
daskoptionalOptional but recommended for large data processing
Agent activity
35 hits · last 30 days
node
34
OpenAI (training)
1
Resources
odc-geo — pip install odc-geo · libregistry