windkit.lines_to_polygons

windkit.lines_to_polygons(lines, check_errors=False)[source]

Converts a GeoDataFrame of lines into polygons.

This function takes a GeoDataFrame containing line geometries and converts them into polygons. The resulting polygons are associated with attributes from the input lines.

Parameters:
  • lines (geopandas.GeoDataFrame) – A GeoDataFrame containing line geometries. The GeoDataFrame must have columns corresponding to the change lines type (e.g., z0_left, z0_right for roughness, id_left, id_right for landcover).

  • check_errors (bool) – Check the input line map for errors, Default False

Returns:

A GeoDataFrame containing polygon geometries with associated attributes from the input lines.

Return type:

geopandas.GeoDataFrame

Raises:

ValueError – If landcover could not be found for all created polygons due to issues in the input geometries.

Warning

UserWarning

If landcover could not be found for all created polygons, indicating potential issues in the input geometries such as dangles or unexpected geometries.

Notes

  • The function creates outer boundary polygons to ensure complete coverage.

  • It uses spatial joins to associate attributes from the input lines with the resulting polygons.

  • The function assumes that the input lines are valid and do not contain invalid geometries.