Skip to content

route

Route(segments, _from, _to, conf, name=None)

Class that represents a route from a start to an end waypoint Attributes: segments (list): a list of Segment object that constitutes the entire route name (String) (optional): string representing the route name from_wp (string): the name of the source waypoint to_wp (string): the name of the destination waypoint conf (dict): the associated route config cases (list): a list of all cases along the route

accumulate_metric(metric)

Finds the cumulative sum over the given metric for the route Args: metric (str): The name of the metric

Returns:

Name Type Description
metric_cumul list

List of cumulative values for the metric at each segment along the route

get_battery()

Goes through the route segments and calculates the entire route's battery usage

get_distance()

Goes through the route segments and calculates the total route distance

get_fuel()

Goes through the route segments and calculates the entire route's fuel usage

get_points()

Gets a list of points along the route

get_time()

Goes through the route segments and calculates the total travel time of the route

save(file_path)

Saves the constructed route to the given file location in the given format

set_cases(cases)

Sets the cases attribute for the route to the given value

to_csv()

Converts the constructed route into csv format

to_geojson()

Converts the constructed route into geojson format

to_gpx()

Converts the constructed route into a geo-dataframe with fields matching gpx format

to_json(route_type='dijkstra')

Converts the constructed route into json format

waypoint_correction(cellbox, wp, cp, indx)

Determine within cell parameters for the source and end point waypoint when away from cell centre and update the relevant segment

Parameters:

Name Type Description Default
cellbox AggregatedCellBox

the cellbox to do the waypoint correction within

required
wp Waypoint

the source or end waypoint

required
cp Waypoint

the crossing point that the route enters or leaves the cell by

required
indx int

the index of the segment along the route

required