odc.geo.xr.rasterize

odc.geo.xr.rasterize(poly, how, *, value_inside=True, all_touched=False)[source]

Generate raster from geometry.

This method is a wrapper for rasterio.features.make_mask().

Parameters:
  • poly (Geometry) – Geometry shape to rasterize.

  • how (Union[float, int, Resolution, GeoBox]) – This could be either just resolution or a GeoBox that fully defines output raster extent/resolution/projection.

  • all_touched (bool) – If True, all pixels touched by geometries will be burned in. If False, only pixels whose center is within the polygon or that are selected by Bresenham’s line algorithm will be burned in.

  • value_inside (bool) – By default pixels inside a polygon will have value of True and False outside, but this can be flipped.

Return type:

DataArray

Returns:

geo-registered data array