geoms_to_raster#

geoms_to_raster(df: GeoDataFrame, window: Box, background_class_id: int, all_touched: bool) ndarray[source]#

Rasterize geometries that intersect with the window.

Parameters:
  • df (gpd.GeoDataFrame) – All label geometries in the scene.

  • window (Box) – The part of the scene to rasterize.

  • background_class_id (int) – Class ID to use for pixels that don’t fall under any label geometry.

  • 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. (See rasterize() for more details). Defaults to False.

Returns:

A raster.

Return type:

np.ndarray