revrt.routing.cli.finalize.RouteToFeatureMapper#

class RouteToFeatureMapper(cost_fpath, transmission_feature_id_col='trans_gid')[source]#

Bases: object

Class to map routes to transmission features

Parameters:
  • cost_fpath (path-like) – Filepath to cost layer used for routing. This is used to obtain profile information for the raster layer in order to compute transmission feature row/column indices.

  • transmission_feature_id_col (str, default "trans_gid") – Name of column in features file uniquely identifying each transmission feature. By default, "trans_gid".

Methods

process(routes, transmission_feature_fp)

Map routes to transmission features

process(routes, transmission_feature_fp)[source]#

Map routes to transmission features

Parameters:
  • routes (pandas.DataFrame or geopandas.GeoDataFrame) – DataFrame containing routing results with ‘end_row’ and ‘end_col’ columns representing the endpoint indices (into the cost raster) of each route.

  • transmission_feature_fp (path-like) – Path to GeoPackage file containing transmission features.

Returns:

pandas.DataFrame or geopandas.GeoDataFrame – Input routes DataFrame with transmission feature columns merged in based on route endpoints.