stems.gis.geom module¶
Geometry related functions
-
stems.gis.geom.
bounds_intersection
(*bounds)[source]¶ Return the intersection of some BoundingBox(s)
- Parameters
bounds (BoundingBox) – Bounding boxes
- Returns
The intersection of all input BoundingBox
- Return type
BoundingBox
-
stems.gis.geom.
bounds_transform_union
(bounds, transform)[source]¶ Calculate union of bounds for some transform
- Parameters
bounds (Sequence[BoundingBox]) – Bounding boxes
transform (Affine) – Affine transform to use
- Returns
rasterio.coords.BoundingBox – Union of BoundingBox
affine.Affine – Unified affine transform
tuple[int, int] – Shape of union (nrow, ncol)
-
stems.gis.geom.
bounds_union
(*bounds)[source]¶ Return the union of some BoundingBox(s)
- Parameters
bounds (BoundingBox) – Bounding boxes
- Returns
The union of all input BoundingBox
- Return type
BoundingBox
-
stems.gis.geom.
calculate_dst_window
(src_bounds, dst_transform)[source]¶ Calculate the rounded source window for some other transform
- Parameters
src_bounds (rasterio.coords.BoundingBox) – Input bounds for the source raster image
dst_transform (affine.Affine) – Destination Affine transform
- Returns
Window of source that conforms (pixel size, upper left) to
dst_tranform
- Return type
-
stems.gis.geom.
calculate_src_window
(src_bounds, src_transform, dst_bounds)[source]¶ Calculate the source window for some output bounds
- Parameters
src_bounds (rasterio.coords.BoundingBox) – Input bounds for the source raster image
src_transform (affine.Affine) – Affine transform for the source raster image
dst_bounds (rasterio.coords.BoundingBox) – Destination bounds
- Returns
rasterio.windows.Window – Window of source that contains
dst_bounds
rasterio.coords.BoundingBox – The BoundingBox representing the destination window for the source