starling_sim.basemodel.topology.empty_network
Module Contents
Classes
An initially empty topology |
- class starling_sim.basemodel.topology.empty_network.EmptyNetwork(transport_mode, weight_class=None, store_paths=False)
Bases:
starling_sim.basemodel.topology.topology.Topology
An initially empty topology
- init_graph()
Initialise the network graph from any data source.
- add_time_and_length(u, v, d)
Set the TIME_ATTRIBUTE and LENGTH_ATTRIBUTE attributes on the graph edge.
- Parameters:
u – edge origin
v – edge destination
d – edge data
- position_localisation(position)
Return the localisation [lat, lon] of the position
- Parameters:
position – position in the topology
- Returns:
list [lat, lon]
- nearest_position(localisation)
Return the nearest position to given localisation (lat, lon)
- Parameters:
localisation – (lat, lon) tuple
- Returns:
position
- 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.
- Parameters:
x_coordinates – list of X coordinates of the localisations (lon in GPS)
y_coordinates – list of Y coordinates of the localisations (lat in GPS)
return_dist – optionally also return distance between points and nearest nodes
- Returns:
list of nearest nodes