pywasp.vector_to_raster

pywasp.vector_to_raster(gdf, res, bounds=None, map_type=None, return_lctable=False)[source]

Converts a geopandas.GeoDataFrame vector map object to a xarray.DataArray raster map object.

Warning

This function is experimental and its signature may change.

Parameters:
  • gdf (geopandas.GeoDataFrame) – vector map to be converted

  • res (float) – Resolution of x and y dimensions (dx, dy)

  • bounds (tuple, windkit.spatial.BBox, optional) – Bounding box of the output raster map. In the format: (xmin, ymin, xmax, ymax). By default (None), the entire geodataframe bounding box is used.

  • map_type ({"roughness","landcover"} or None) – Only used when the gdf is of polygon type, controls whether the output is a raster with roughness (z0) or landcover id, default “roughness”.

  • return_lctable (bool) – Only used when the gdf is of polygon type, whether to return the landcover table, default False

Returns:

xarray.DataArray – Rastermap representation of the map