nrel.hive.model.roadnetwork.route

Module Contents

Functions

empty_route(→ Route)

route_distance_km(→ nrel.hive.util.units.Kilometers)

Return the distance of the route in kilometers

route_travel_time_seconds(→ nrel.hive.util.units.Seconds)

returns the travel time, in seconds, for a route

route_cooresponds_with_entities(→ bool)

validates that the route correctly corresponds with any related entities

to_linestring(→ str)

converts the traversal to a WKT linestring or an empty polygon if the traversal was empty

routes_are_connected(→ bool)

tests the connectivity between two successive routes. if either route is

Attributes

Route

nrel.hive.model.roadnetwork.route.Route
nrel.hive.model.roadnetwork.route.empty_route() Route[source]
nrel.hive.model.roadnetwork.route.route_distance_km(route: Route) nrel.hive.util.units.Kilometers[source]

Return the distance of the route in kilometers

Parameters:

route – route to calculate distance on

Return type:

kilometers

Returns:

the distance in kilometers

nrel.hive.model.roadnetwork.route.route_travel_time_seconds(route: Route) nrel.hive.util.units.Seconds[source]

returns the travel time, in seconds, for a route

Parameters:

route – route to calculate time from

Returns:

the travel time, in seconds

nrel.hive.model.roadnetwork.route.route_cooresponds_with_entities(route: Route, src: nrel.hive.model.entity_position.EntityPosition, dst: nrel.hive.model.entity_position.EntityPosition | None = None) bool[source]

validates that the route correctly corresponds with any related entities

Parameters:
  • route – the route

  • src – a source position

  • dst – an optional destination position

Returns:

if the route is valid for this src(/dst)

nrel.hive.model.roadnetwork.route.to_linestring(route: Route, env: nrel.hive.runner.Environment) str[source]

converts the traversal to a WKT linestring or an empty polygon if the traversal was empty see https://en.wikipedia.org/wiki/Well-known_text_representation_of_geometry

Parameters:

route – a route

Returns:

a linestring or an empty WKT

nrel.hive.model.roadnetwork.route.routes_are_connected(prev_route: Route, next_route: Route) bool[source]

tests the connectivity between two successive routes. if either route is empty, the test is trivially true, since any empty route joined with another route is not disconnected - allowing for edge cases in re-routing, such as calling a re-routings where two trips have the same destination.

Parameters:
  • prev_route – the previous route

  • next_route – the next route

Returns:

true if the routes are connected, or if at least one route is empty