revrt.routing.processing.BatchRouteProcessor#

class BatchRouteProcessor(routing_scenario, route_definitions, route_attrs=None, mem_limit_gb=4)[source]#

Bases: object

Class to manage batches of route computations

Parameters:
  • routing_scenario (revrt.routing.base.RoutingScenario) – Scenario describing the cost layers and routing options.

  • route_definitions (Iterable) – Sequence of (start_points, end_points, option) tuples defining which points to route between. Each of start_points and end_points should be a list of (row, col, option_name) tuples.

  • route_attrs (dict, optional) – Mapping of tuples of the form (int, (int, int, option)) where the first integer represents the route ID and the tuple of integers + str represents the starting index to additional attributes to include in the output for that route. By default, None.

  • mem_limit_gb (int or float, default 4) – Memory limit in gigabytes for routing computations. By default, 4.

Methods

process(out_fp[, save_paths, ...])

Compute all routes and save to disk

Attributes

default_attrs

Default attributes for all routes

route_attrs

Mapping of frozen route node pair sets to attributes

route_definitions

Validated route definitions for computation

routing_layers

Built routing layers for the scenario

property default_attrs[source]#

Default attributes for all routes

Type:

dict

property route_attrs[source]#

Mapping of frozen route node pair sets to attributes

Type:

dict

property routing_layers[source]#

Built routing layers for the scenario

Type:

RoutingLayerManager

property route_definitions[source]#

Validated route definitions for computation

Type:

list

process(out_fp, save_paths=False, routing_layer_out_fp=None)[source]#

Compute all routes and save to disk

Parameters:
  • out_fp (path-like) – Path to output file. If save_paths=True, a GeoPackage will be created (recommend to pass in a filepath ending in “.gpkg”). Otherwise, a CSV file will be created (recommend to pass in a filepath ending in “.csv”).

  • save_paths (bool, default False) – Include shapely geometries in the output when True. By default, False.

  • routing_layer_out_fp (path-like, optional) – Optional output path for Rust routing-layer cache data. By default, None.