vibespatial.raster.geokeys

GeoTIFF GeoKey parsing for nvImageCodec geo metadata.

Converts raw GeoKey dicts (MODEL_PIXEL_SCALE, MODEL_TIEPOINT, EPSG codes) into the affine 6-tuple and pyproj.CRS that vibespatial-raster uses.

No dependency on nvImageCodec, CuPy, or rasterio.

Functions

geokeys_to_affine(→ tuple[float, float, float, float, ...)

Convert GeoTIFF geo-referencing tags to a GDAL-style affine 6-tuple.

geokeys_to_crs(→ pyproj.CRS | None)

Build a pyproj.CRS from a GeoTIFF EPSG code.

parse_nvimgcodec_geo_metadata(→ tuple[tuple[float, ...)

Parse an nvImageCodec geo-metadata dict into an affine tuple and CRS.

Module Contents

vibespatial.raster.geokeys.geokeys_to_affine(pixel_scale: list[float] | None = None, tiepoint: list[float] | None = None, model_transformation: list[float] | None = None) tuple[float, float, float, float, float, float] | None

Convert GeoTIFF geo-referencing tags to a GDAL-style affine 6-tuple.

The affine tuple (a, b, c, d, e, f) maps pixel coordinates to world coordinates:

world_x = a * col + b * row + c world_y = d * col + e * row + f

Parameters

pixel_scalelist[float] or None

MODEL_PIXEL_SCALE[scaleX, scaleY, scaleZ].

tiepointlist[float] or None

MODEL_TIEPOINT[i, j, k, x, y, z].

model_transformationlist[float] or None

MODEL_TRANSFORMATION — 16-element row-major 4x4 matrix.

Returns

tuple[float, float, float, float, float, float] or None

(a, b, c, d, e, f) affine, or None if insufficient data.

vibespatial.raster.geokeys.geokeys_to_crs(epsg_code: int | None, *, model_type: int | None = None) pyproj.CRS | None

Build a pyproj.CRS from a GeoTIFF EPSG code.

Parameters

epsg_codeint or None

EPSG code (e.g. 4326, 32633). None means no CRS.

model_typeint or None

GT_MODEL_TYPE (1 = Projected, 2 = Geographic). Currently informational only; the EPSG code already encodes this distinction.

Returns

CRS or None

A pyproj.CRS object, or None if the code is missing or unrecognised.

vibespatial.raster.geokeys.parse_nvimgcodec_geo_metadata(geo_metadata: dict) tuple[tuple[float, float, float, float, float, float] | None, pyproj.CRS | None]

Parse an nvImageCodec geo-metadata dict into an affine tuple and CRS.

This is the main entry point for converting the raw dict that nvImageCodec attaches to decoded GeoTIFF images.

Parameters

geo_metadatadict

Raw geo-metadata dict with keys such as MODEL_PIXEL_SCALE, MODEL_TIEPOINT, MODEL_TRANSFORMATION, PROJECTED_CRS, GEODETIC_CRS, and GT_MODEL_TYPE.

Returns

tuple[tuple | None, CRS | None]

(affine, crs) — either value may be None when the corresponding metadata is missing or unparseable.