revrt.utilities.base.buffer_routes#

buffer_routes(routes, row_widths=None, row_width_ranges=None, row_width_key='voltage')[source]#

Buffer routes by specified row widths or row width ranges

Warning

Paths without a valid voltage in the row_widths or row_width_ranges input will be dropped from the output.

Parameters:
  • routes (geopandas.GeoDataFrame) – GeoDataFrame of routes to buffer. This dataframe must contain the route geometry as well as the row_width_key column.

  • row_widths (dict, optional) – A dictionary specifying the row widths in the following format: {"row_width_id": row_width_meters}. The row_width_id is a value used to match each route with a particular ROW width (this is typically a voltage). The value should be found under the row_width_key entry of the routes.

    Important

    At least one of row_widths or row_width_ranges must be provided.

    By default, None.

  • row_width_ranges (list, optional) – Optional list of dictionaries, where each dictionary contains the keys “min”, “max”, and “width”. This can be used to specify row widths based on ranges of values (e.g. voltage). For example, the following input:

    [
        {"min": 0, "max": 70, "width": 20},
        {"min": 70, "max": 150, "width": 30},
        {"min": 200, "max": 350, "width": 40},
        {"min": 400, "max": 500, "width": 50},
    ]
    

    would map voltages in the range 0 <= volt < 70 to a row width of 20 meters, 70 <= volt < 150 to a row width of 30 meters, 200 <= volt < 350 to a row width of 40 meters, and so-on.

    Important

    Any values in the row_widths dict will take precedence over these ranges. So if a voltage of 138 kV is mapped to a row width of 25 meters in the row_widths dict, that value will be used instead of the 30 meter width specified by the ranges above.

    By default, None.

  • row_width_key (str, default "voltage") – Name of column in vector file of routes used to map to the ROW widths. By default, "voltage".

Returns:

geopandas.GeoDataFrame – Route input with buffered paths (and without routes that are missing a voltage specification in the row_widths or row_width_ranges input).

Raises:

revrtValueError – If neither row_widths nor row_width_ranges are provided.