nrel.hive.model.roadnetwork.osm.osm_roadnetwork_ops
Module Contents
Functions
attempts to extract lat/lon location from a graph node attribute |
|
|
takes a networkx shortest path result (a list of node ids) and turns it into a Route (list of Links) |
our inner_route is a shortest path from the destination of the source link to the start |
- nrel.hive.model.roadnetwork.osm.osm_roadnetwork_ops.safe_get_node_coordinates(node: networkx.classes.reportviews.NodeView, node_id: int) nrel.hive.model.roadnetwork.link_id.Tuple[nrel.hive.model.roadnetwork.link_id.Optional[Exception], nrel.hive.model.roadnetwork.link_id.Optional[nrel.hive.model.roadnetwork.link_id.Tuple[float, float]]][source]
attempts to extract lat/lon location from a graph node attribute :param node: the node attribute :param node_id: the node id :return: coordinate in lat/lon (y/x) ordering, or, an error
- nrel.hive.model.roadnetwork.osm.osm_roadnetwork_ops.route_from_nx_path(nx_path: list | dict, link_lookup: immutables.Map[nrel.hive.model.roadnetwork.link_id.LinkId, nrel.hive.model.roadnetwork.link.Link]) nrel.hive.model.roadnetwork.link_id.Tuple[nrel.hive.model.roadnetwork.link_id.Optional[Exception], nrel.hive.model.roadnetwork.link_id.Optional[nrel.hive.model.roadnetwork.route.Route]][source]
takes a networkx shortest path result (a list of node ids) and turns it into a Route (list of Links) :param nx_path: the networkx path result :param link_lookup: a table of Links by LinkId in this simulation :return: an error, or, the resulting Route
- nrel.hive.model.roadnetwork.osm.osm_roadnetwork_ops.resolve_route_src_dst_positions(inner_route: nrel.hive.model.roadnetwork.route.Route, src_link_pos: nrel.hive.model.entity_position.EntityPosition, dst_link_pos: nrel.hive.model.entity_position.EntityPosition, road_network: nrel.hive.model.roadnetwork.osm.osm_roadnetwork.OSMRoadNetwork) nrel.hive.model.roadnetwork.link_id.Optional[nrel.hive.model.roadnetwork.route.Route][source]
our inner_route is a shortest path from the destination of the source link to the start of the destination link. a ‘positional’ Link has been provided in the search query, assumed to represent the static road network location of some entities. to complete the route, the origin and destination links must be attached in a way that their start/end locations correspond with the query entities.
- Parameters:
inner_route – the result of a shortest path search
src_link_pos – the positional Link representation of an Entity
dst_link_pos – the positional Link representation of another Entity
road_network – the underlying OSM road network state
- Returns:
a route if it is valid, otherwise None