API Reference

odc.geo

XY(x, y)

Immutable container for anything X/Y.

XY.xy

Convert to tuple in X,Y order.

XY.yx

Convert to tuple in Y,X order.

XY.lonlat

Convert to tuple in Longitude,Latitude order.

XY.latlon

Convert to tuple in Latitude,Longitude order.

XY.x

Access X value.

XY.y

Access Y value.

XY.lon

Access Longitude value (X).

XY.lat

Access Latitude value (Y).

XY.wh

Interpret as width, height, (X, Y) order.

XY.shape

Interpret as shape (Y, X) order.

Resolution(x[, y])

Resolution for X/Y dimensions.

Shape2d(x, y)

2d shape.

Index2d(x, y)

2d index.

xy_()

Construct from X,Y order.

yx_()

Construct from Y,X order.

res_(x, /)

Resolution for square pixels with inverted Y axis.

resxy_(x, y, /)

Construct resolution from X,Y order.

resyx_(y, x, /)

Construct resolution from Y,X order.

wh_(w, h, /)

Shape from width/height.

shape_(x)

Normalise shape representation.

ixy_()

Construct 2d index in X,Y order.

iyx_()

Construct 2d index in Y,X order.

odc.geo.crs

CRS(crs_spec)

Wrapper around pyproj.crs.CRS for backwards compatibility.

CRSMismatchError

CRS Mismatch Error.

norm_crs()

Normalise CRS representation.

norm_crs_or_error(crs)

Normalise CRS representation, raise error if input is None.

crs_units_per_degree(crs, lon[, lat, step])

Helper method for converting resolution between meters/degrees.

CRS

to_epsg()

EPSG Code of the CRS or None.

to_wkt([pretty, version])

Generate WKT representation of this CRS.

transformer_to_crs(other[, always_xy])

Build coordinate transformer to other projection.

units

List of dimension units of the CRS.

dimensions

List of dimension names of the CRS.

odc.geo.geobox

GeoBox(shape, affine, crs)

Defines the location and resolution of a rectangular grid of data, including it's CRS.

GeoboxTiles(box, tile_shape)

Partition GeoBox into sub geoboxes.

bounding_box_in_pixel_domain(geobox, reference)

Bounding box of geobox in pixel space of reference.

geobox_intersection_conservative(geoboxes)

Intersection of geoboxes.

geobox_union_conservative(geoboxes)

Union of geoboxes as a geobox.

scaled_down_geobox(src_geobox, scaler)

Compute GeoBox of a zoomed image.

affine_transform_pix(gbox, transform)

Alias for odc.geo.geobox.GeoBox.__mul__().

flipx(gbox)

Alias for odc.geo.geobox.flipx().

flipy(gbox)

Alias for odc.geo.geobox.flipy().

gbox_boundary(gbox[, pts_per_side])

Alias for odc.geo.geobox.GeoBox.boundary().

pad(gbox, padx[, pady])

Alias for odc.geo.geobox.GeoBox.pad().

pad_wh(gbox[, alignx, aligny])

Alias for odc.geo.geobox.GeoBox.pad_wh().

rotate(gbox, deg)

Alias for odc.geo.geobox.GeoBox.().

translate_pix(gbox, tx, ty)

Alias for odc.geo.geobox.GeoBox.translate_pix().

zoom_out(gbox, factor)

Alias for odc.geo.geobox.GeoBox.zoom_out().

zoom_to(gbox, shape)

Alias for odc.geo.geobox.GeoBox.zoom_to().

GeoBox

GeoBox.affine

Linear mapping from pixel space to CRS.

GeoBox.alignment

Alignment of pixel boundaries in CRS units.

GeoBox.boundary([pts_per_side])

Boundary of a GeoBox.

GeoBox.buffered(xbuff[, ybuff])

Produce a tile buffered by xbuff, ybuff (in CRS units).

GeoBox.coordinates

Query coordinates.

GeoBox.coords

Query coordinates.

GeoBox.crs

Coordinate Reference System of the GeoBox.

GeoBox.dimensions

List of dimension names of the GeoBox.

GeoBox.dims

List of dimension names of the GeoBox.

GeoBox.extent

GeoBox footprint in native CRS.

GeoBox.flipx()

Flip along X axis.

GeoBox.flipy()

Flip along Y axis.

GeoBox.from_geopolygon(geopolygon, resolution)

Construct GeoBox from a polygon.

GeoBox.geographic_extent

GeoBox extent in EPSG:4326.

GeoBox.height

Height in pixels (ny).

GeoBox.is_empty()

Check if geobox is "empty".

GeoBox.pad(padx[, pady])

Pad geobox.

GeoBox.pad_wh([alignx, aligny])

Possibly expand GeoBox by a few pixels.

GeoBox.resolution

Resolution, pixel size in CRS units.

GeoBox.rotate(deg)

Rotate GeoBox around the center.

GeoBox.shape

Shape in pixels (height, width).

GeoBox.transform

Linear mapping from pixel space to CRS.

GeoBox.translate_pix(tx, ty)

Shift GeoBox in pixel plane.

GeoBox.width

Width in pixels (nx).

GeoBox.zoom_out(factor)

Compute GeoBox with changed resolution.

GeoBox.zoom_to(shape)

Change GeoBox shape.

GeoBox.__mul__(transform)

Apply affine transform on pixel side.

GeoBox.__rmul__(transform)

Apply affine transform on CRS side.

Coordinate

Coordinate.count(value, /)

Return number of occurrences of value.

Coordinate.index(value[, start, stop])

Return first index of value.

Coordinate.resolution

Alias for field number 2

Coordinate.units

Alias for field number 1

Coordinate.values

Alias for field number 0

GeoboxTiles

GeoboxTiles.base

Access base Geobox

GeoboxTiles.chunk_shape(idx)

Query chunk shape for a given chunk.

GeoboxTiles.range_from_bbox(bbox)

Intersect with a bounding box.

GeoboxTiles.shape

Number of tiles along each dimension.

GeoboxTiles.tiles(polygon)

Return tile indexes overlapping with a given geometry.

odc.geo.geom

Geometry(geom[, crs])

2D Geometry with CRS.

Geometry.to_crs(crs[, resolution, wrapdateline])

Convert geometry to a different Coordinate Reference System.

Geometry.geojson([properties, simplify, ...])

Render geometry to GeoJSON.

BoundingBox(left, bottom, right, top[, crs])

Bounding box, defining extent in cartesian coordinates.

box(left, bottom, right, top, crs)

Create a 2D Box (Polygon).

line(coords, crs)

Create a 2D LineString (Connected set of lines).

point(x, y, crs)

Create a 2D Point.

polygon(outer, crs, *inners)

Create a 2D Polygon.

multigeom(geoms)

Construct Multi{Polygon|LineString|Point}.

multiline(coords, crs)

Create a 2D MultiLineString (Multiple disconnected sets of lines).

multipoint(coords, crs)

Create a 2D MultiPoint Geometry.

multipolygon(coords, crs)

Create a 2D MultiPolygon.

polygon_from_transform(shape, transform, crs)

Create a 2D Polygon from an affine transform and shape.

chop_along_antimeridian(geom[, precision])

Chop a geometry along the antimeridian.

clip_lon180(geom[, tol])

Tweak Geometry in the vicinity of longitude discontinuity.

common_crs(geoms)

Compute common CRS.

densify(coords, resolution)

Adds points so they are at most resolution units apart.

intersects(a, b)

Check for intersection.

lonlat_bounds(geom[, mode, resolution])

Return the bounding box of a geometry.

mid_longitude(geom)

Compute longitude of the center point of a geometry.

projected_lon(crs, lon[, lat, step])

Project vertical line along some longitude into a given CRS.

sides(poly)

Returns a sequence of Geometry[Line] objects.

bbox_intersection(bbs)

Compute intersection of boudning boxes.

bbox_union(bbs)

Compute union of bounding boxes.

unary_intersection(geoms)

Compute intersection of multiple (multi)polygons.

unary_union(geoms)

Compute union of multiple (multi)polygons efficiently.

odc.geo.roi

polygon_path(x[, y])

Points along axis aligned polygon.

roi_boundary(roi[, pts_per_side])

Get boundary points from a 2d roi.

roi_center()

Return center point of an roi.

roi_from_points(xy, shape[, padding, align])

Build ROI from sample points.

roi_intersect()

Compute intersection of two ROIs.

roi_is_empty(roi)

Check if ROI is "empty".

roi_is_full(roi, shape)

Check if ROI covers the entire region.

roi_normalise()

Normalise ROI.

roi_pad()

Pad ROI on each side, with clamping.

roi_shape(roi)

Shape of an array after cropping with roi.

scaled_down_roi(roi, scale)

Compute ROI for a scaled down image.

scaled_down_shape(shape, scale)

Compute shape of the overview image.

scaled_up_roi(roi, scale[, shape])

Compute ROI for a scaled up image.

odc.geo.math

Bin1D(sz[, origin, direction])

Class for translating continous coordinates to bin index.

Bin1D.bin(x)

Lookup bin index that x falls into.

Bin1D.from_sample_bin(idx, bin[, direction])

Construct Bin1D from a sample.

affine_from_axis(xx, yy[, fallback_resolution])

Compute Affine transform from axis.

align_down(x, align)

Align integer down.

align_up(x, align)

Align integer up.

apply_affine(A, x, y)

Broadcast A*(x_i, y_i) across all elements of x/y.

clamp(x, lo, up)

Clamp x to be lo <= x <= up.

data_resolution_and_offset(data[, ...])

Compute resolution and offset from x/y axis data.

is_affine_st(A[, tol])

Check if transfrom is pure scale and translation.

is_almost_int(x, tol)

Check if number is close enough to an integer.

maybe_int(x, tol)

Turn almost ints to actual ints.

maybe_zero(x, tol)

Turn almost zeros to actual zeros.

snap_scale(s[, tol])

Snap scale.

snap_affine(A[, ttol, stol, tol])

Snap scale and translation parts to integer when close enough.

split_float(x)

Split float number into whole and fractional parts.

split_translation(t)

Split translation into pixel aligned and sub-pixel parts.

odc.geo.gridspec

GridSpec(crs, tile_shape, resolution[, ...])

Definition for a regular spatial grid.

GridSpec.from_sample_tile(box, *[, shape, ...])

Construct odc.geo.gridspec.GridSpec from a sample tile.

GridSpec.web_tiles(zoom[, npix])

Construct GridSpec that matches slippy tiles.

GridSpec.alignment

Pixel boundary alignment.

GridSpec.dimensions

List of dimension names of the grid spec.

GridSpec.tile_shape

Tile shape in pixels (Y,X order, like numpy).

GridSpec.pt2idx(x, y)

Compute tile index from a point.

GridSpec.tile_geobox(tile_index)

Tile geobox.

GridSpec.__getitem__(idx)

Lookup GeoBox of a given tile.

GridSpec.tiles(bounds[, geobox_cache])

Query tiles overlapping with bounding box.

GridSpec.tiles_from_geopolygon(geopolygon[, ...])

Query tiles overlapping with a given polygon.

GridSpec.geojson(*[, bbox, geopolygon])

Render to GeoJSON.