polaris.network.tools.tools.Tools#

class polaris.network.tools.tools.Tools(geo_tools: Geo, data_tables: DataTableCache, path_to_file: PathLike)#

Bases: WorkerThread

Tools for general manipulation of the network

To ensure that network links are no longer than a certain threshold (e.g. 1,000m), one can do the following

project = Network()
project.open(project_file_path)
tools.break_links(1000)
project.close()
__init__(geo_tools: Geo, data_tables: DataTableCache, path_to_file: PathLike)#

Methods

__init__(geo_tools, data_tables, path_to_file)

break_links(max_length[, rebuild_network])

Breaks all links in the road network in such a way that no link is longer than the maximum threshold.

doWork()

Runs work set in QGIS.

rebuild_intersections([signals, signs])

Rebuilds all intersections and intersection controls

rebuild_location_links([maximum_distance, ...])

Rebuilds the Location_Links table completely

rebuild_location_parking(maximum_distance)

Rebuilds the Location_Parking table

Attributes

tooling = <polaris.utils.python_signal.PythonSignal object>#
__init__(geo_tools: Geo, data_tables: DataTableCache, path_to_file: PathLike)#

Breaks all links in the road network in such a way that no link is longer than the maximum threshold. Links are broken in equal parts. It also enforces consistency after breaking links.

Args:

max_length (float): Maximum length of any link in the roadway network rebuild_network (bool): True if required to rebuild the network. DO NOT USE FALSE

Rebuilds the Location_Links table completely

This method should be called only after all updates to the Location table have been completed

Args:

maximum_distance (float): Maximum distance for which a link can be connected to a location (excludes closest link) multiple_links (bool): Connects each location to multiple links in the same block if True and only to the nearest link if false. Defaults to True

rebuild_intersections(signals=None, signs=None)#

Rebuilds all intersections and intersection controls

Args:
signals (:obj:[list, str], Optional): Rebuilds existing signals when not provided, When a list of

nodes, adds signals for them. May also be ‘osm’ or ‘geometric’. see documentation of Intersection for details

signs (:obj:[list, str], Optional): List of node IDs with stop signs. When None, rebuilds existing signs,

and when [] evaluates all non-signalized intersections

rebuild_location_parking(maximum_distance: float)#

Rebuilds the Location_Parking table

it also creates synthetic Parking entries for each location without parking

doWork()#

Runs work set in QGIS. Not for use in the Python interface