{"id":21636,"library":"odc-geo","title":"ODC Geo - Geometry Classes and Operations","description":"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.","status":"active","version":"0.5.1","language":"python","source_language":"en","source_url":"https://github.com/opendatacube/odc-geo/","tags":["geospatial","opendatacube","geometry","crs","xarray","dask","GDAL"],"install":[{"cmd":"pip install odc-geo","lang":"bash","label":"Install from PyPI"}],"dependencies":[{"reason":"Required for xarray integration (was optional before v0.5.0)","package":"xarray","optional":false},{"reason":"Core dependency for geometry operations","package":"shapely","optional":false},{"reason":"Used for CRS and raster I/O","package":"rasterio","optional":false},{"reason":"Optional but recommended for large data processing","package":"dask","optional":true}],"imports":[{"note":"Correct import path","symbol":"GeoBox","correct":"from odc.geo import GeoBox"},{"note":"Correct import path","symbol":"Geometry","correct":"from odc.geo import Geometry"},{"note":"Correct import path","symbol":"BoundingBox","correct":"from odc.geo import BoundingBox"},{"note":"Avoid importing from odc.geo.crs unless specifically needed for CRS operations","symbol":"CRS","correct":"from odc.geo.crs import CRS"},{"note":"xr_zeros is a top-level function, not submodule","symbol":"odc.geo.xr","correct":"from odc.geo import xr_zeros"}],"quickstart":{"code":"from odc.geo import GeoBox, CRS\nfrom odc.geo.xr import xr_zeros\nimport os\n\n# Define a GeoBox\ncrs = CRS('EPSG:4326')\ngeobox = GeoBox.from_bbox((-10, 10, 10, -10), crs=crs, resolution=0.1)\nprint(geobox)\n\n# Create an xarray DataArray with geospatial info\nda = xr_zeros(geobox)\nprint(da)\n\n# Basic reproject (if dask available)\nif 'PYTEST_CURRENT_TEST' not in os.environ:\n    da_reproj = da.odc.reproject('EPSG:3857', resolution=100)\n    print(da_reproj)","lang":"python","description":"Create a GeoBox from bounding box, generate a zero-filled DataArray, and reproject."},"warnings":[{"fix":"Ensure xarray is installed: pip install xarray","message":"In v0.5.0, xarray became a required dependency. Code that previously imported odc.geo without xarray installed will break.","severity":"breaking","affected_versions":">=0.5.0"},{"fix":"Always specify shape as (height, width) when constructing GeoBox.","message":"GeoBox dimensions order is (height, width), not (width, height). Using incorrect order leads to swapped axes.","severity":"gotcha","affected_versions":"all"},{"fix":"Use the public API: from odc.geo import Geometry instead.","message":"Importing from odc.geo._deprecated or using legacy functions like `odc.geo.geom.polygon` is deprecated and may be removed in future.","severity":"deprecated","affected_versions":"<=0.5.1"},{"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).","message":"odc.geo.crs.CRS was changed: the constructor now enforces stricter validation of EPSG codes. Invalid codes raise an error instead of silently using WGS84.","severity":"breaking","affected_versions":">=0.4.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Run: pip install odc-geo","cause":"odc-geo is not installed or installed in a different environment.","error":"ModuleNotFoundError: No module named 'odc.geo'"},{"fix":"Upgrade: pip install --upgrade odc-geo. Use correct import: from odc.geo import GeoBox","cause":"An outdated version (<0.4.0) where GeoBox was not in the public API or path changed.","error":"ImportError: cannot import name 'GeoBox' from 'odc.geo'"},{"fix":"Ensure you provide resolution or shape when creating GeoBox. Example: GeoBox.from_bbox(bbox, crs=crs, resolution=0.1)","cause":"GeoBox shape was not set or is None; often from missing resolution in from_bbox.","error":"TypeError: 'NoneType' object is not subscriptable when accessing .shape"},{"fix":"Upgrade Shapely: pip install --upgrade shapely","cause":"odc-geo requires Shapely 2.0+; older versions are incompatible.","error":"ValueError: Expected 'shapely' >=2.0, found version ..."}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}