:py:mod:`starling_sim.basemodel.topology.osm_network` ===================================================== .. py:module:: starling_sim.basemodel.topology.osm_network Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: starling_sim.basemodel.topology.osm_network.OSMNetwork .. py:class:: OSMNetwork(transport_mode, weight_class=None, store_paths=False, network_file=None, speed_file=None, graph=None) Bases: :py:obj:`starling_sim.basemodel.topology.topology.Topology` Open Street Map network topology .. py:method:: init_graph() Initialise the network graph from any data source. .. py:method:: add_time_and_length(u, v, d) Set the edge time and length using the speeds dict and OSM length values. Speeds are set according to OSM 'highway' attribute. If the attribute's value doesn't correspond to any key, use the 'other' key. :param u: :param v: :param d: .. py:method:: position_localisation(position) Return the localisation [lat, lon] of the position :param position: position in the topology :return: list [lat, lon] .. py:method:: nearest_position(localisation) Return the nearest position to given localisation (lat, lon) :param localisation: (lat, lon) tuple :return: position .. py:method:: localisations_nearest_nodes(x_coordinates, y_coordinates, return_dist=False) Return the graph nodes nearest to a list of points. This method should allow a faster computation than multiple nearest_position calls. :param x_coordinates: list of X coordinates of the localisations (lon in GPS) :param y_coordinates: list of Y coordinates of the localisations (lat in GPS) :param return_dist: optionally also return distance between points and nearest nodes :return: list of nearest nodes