nrel.hive.model.roadnetwork.osm.osm_roadnetwork

Module Contents

Classes

OSMRoadNetwork

Implements an open street maps road network utilizing the osmnx and networkx libraries

Attributes

log

TIME_WEIGHT

nrel.hive.model.roadnetwork.osm.osm_roadnetwork.log[source]
nrel.hive.model.roadnetwork.osm.osm_roadnetwork.TIME_WEIGHT = 'travel_time'
class nrel.hive.model.roadnetwork.osm.osm_roadnetwork.OSMRoadNetwork(graph: networkx.MultiDiGraph, sim_h3_resolution: nrel.hive.util.typealiases.H3Resolution = 15, default_speed_kmph: nrel.hive.util.units.Kmph = 40.0)[source]

Bases: nrel.hive.model.roadnetwork.roadnetwork.RoadNetwork

Implements an open street maps road network utilizing the osmnx and networkx libraries

classmethod from_polygon(polygon, sim_h3_resolution: nrel.hive.util.typealiases.H3Resolution = 15, default_speed_kmph: nrel.hive.util.units.Kmph = 40.0, cache_dir=Path.home()) OSMRoadNetwork[source]

Build an OSMRoadNetwork from a shapely polygon

Parameters:
  • polygon – The polygon to build the road network from

  • sim_h3_resolution – The h3 resolution of the simulation

  • default_speed_kmph – The network will fill in missing speed values with this

classmethod from_file(road_network_file: pathlib.Path | str, sim_h3_resolution: nrel.hive.util.typealiases.H3Resolution = 15, default_speed_kmph: nrel.hive.util.units.Kmph = 40.0) OSMRoadNetwork[source]

Build an OSMRoadNetwork from file

to_file(file: str | pathlib.Path)[source]
route(origin: nrel.hive.model.entity_position.EntityPosition, destination: nrel.hive.model.entity_position.EntityPosition) nrel.hive.model.roadnetwork.route.Route[source]

Returns a route containing road network links between the origin and destination geoids.

Parameters:
  • origin – the origin Link

  • destination – the destination Link

Returns:

a route between the origin and destination on the OSM road network

distance_by_geoid_km(origin: nrel.hive.util.typealiases.GeoId, destination: nrel.hive.util.typealiases.GeoId) nrel.hive.util.units.Kilometers[source]

Returns the road network distance between the origin and destination

Parameters:
  • origin – the geoid of the origin

  • destination – the geoid of the destination

Returns:

the road network distance in kilometers

Returns the closest link to a geoid.

Parameters:

geoid – the geoid to snap to the road newtork

Returns:

the link on the road network that is closest to the geoid

look up the provided LinkId in the LinkHelper table :param link_id: the LinkId to look up :return: the Link if it exists, otherwise None

geoid_within_geofence(geoid: nrel.hive.util.typealiases.GeoId) bool[source]

Determines if a specific geoid is contained within the road network geofence.

Parameters:

geoid – the geoid to test

Returns:

True/False

abstract update(sim_time: nrel.hive.model.sim_time.SimTime) nrel.hive.model.roadnetwork.roadnetwork.RoadNetwork[source]

requests an update to the road network state to refect the provided simulation time

Parameters:

sim_time

Returns: