voxcity.geoprocessor.raster.landcover ===================================== .. py:module:: voxcity.geoprocessor.raster.landcover Functions --------- .. autoapisummary:: voxcity.geoprocessor.raster.landcover.tree_height_grid_from_land_cover voxcity.geoprocessor.raster.landcover.create_land_cover_grid_from_geotiff_polygon voxcity.geoprocessor.raster.landcover.create_land_cover_grid_from_gdf_polygon Module Contents --------------- .. py:function:: tree_height_grid_from_land_cover(land_cover_grid_ori: numpy.ndarray) -> numpy.ndarray Convert a land cover grid to a tree height grid. Expects 1-based land cover indices where class 5 is Tree. .. py:function:: create_land_cover_grid_from_geotiff_polygon(tiff_path: str, mesh_size: float, land_cover_classes: Dict[str, Any], polygon: List[Tuple[float, float]]) -> numpy.ndarray Create a land cover grid from a GeoTIFF file within a polygon boundary. Uses :func:`compute_cell_center_coords` so rotated rectangles are handled correctly. .. py:function:: create_land_cover_grid_from_gdf_polygon(gdf, meshsize: float, source: str, rectangle_vertices: List[Tuple[float, float]], default_class: str = 'Developed space', detect_ocean: bool = True, land_polygon='NOT_PROVIDED') -> numpy.ndarray Create a grid of land cover classes from GeoDataFrame polygon data. Uses vectorized rasterization for ~100x speedup over cell-by-cell intersection. Correctly handles rotated rectangles by rasterizing onto a bounding-box grid and then sampling at the rotated cell centre coordinates. :param gdf: GeoDataFrame with land cover polygons and 'class' column :param meshsize: Grid cell size in meters :param source: Land cover data source name (e.g., 'OpenStreetMap') :param rectangle_vertices: List of (lon, lat) tuples defining the area :param default_class: Default class for cells not covered by any polygon :param detect_ocean: If True, use OSM land polygons to detect ocean areas. Areas outside land polygons will be classified as 'Water' instead of the default class. :param land_polygon: Optional pre-computed land polygon from OSM coastlines. If provided (including None), this is used directly. If "NOT_PROVIDED", coastlines will be queried when detect_ocean=True. :returns: 2D numpy array of land cover class names