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(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.

affine_transform_pix(gbox, transform)

Apply affine transform on pixel side.

bounding_box_in_pixel_domain(geobox, reference)

Bounding box of geobox in pixel space of reference.

flipx(gbox)

Flip along X axis.

flipy(gbox)

Flip along Y axis.

gbox_boundary(gbox[, pts_per_side])

Boundary of a GeoBox.

geobox_intersection_conservative(geoboxes)

Intersection of geoboxes.

geobox_union_conservative(geoboxes)

Union of geoboxes as a geobox.

pad(gbox, padx[, pady])

Pad geobox.

pad_wh(gbox[, alignx, aligny])

Expand GeoBox such that width and height are multiples of supplied number.

rotate(gbox, deg)

Rotate GeoBox around the center.

scaled_down_geobox(src_geobox, scaler)

Compute GeoBox of a zoomed image.

translate_pix(gbox, tx, ty)

Shift GeoBox in pixel plane.

zoom_out(gbox, factor)

Compute GeoBox with changed resolution.

zoom_to(gbox, shape)

Change GeoBox shape.

GeoBox

GeoBox.alignment

Alignment of pixel boundaries in CRS units.

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.from_geopolygon(geopolygon, resolution)

Construct GeoBox from a polygon.

GeoBox.geographic_extent

GeoBox extent in EPSG:4326.

GeoBox.is_empty()

Check if geobox is "empty".

GeoBox.resolution

Resolution, pixel size in CRS units.

GeoBox.shape

Shape in pixels (height, width).

GeoBox.transform

Linear mapping from pixel space to CRS.

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)

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(width, height, ...)

Create a 2D Polygon from an affine transform.

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(roi)

Return center point of an roi.

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

Build ROI from sample points.

roi_intersect(a, b)

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(roi, shape)

Normalise ROI.

roi_pad(roi, pad, shape)

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.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.