ra2ce.network.network_config_data package#

Enums#

Classes#

class NetworkSection(directed=False, source=<factory>, primary_file=None, diversion_file=None, file_id='', link_type_column='highway', polygon=None, network_type=<factory>, road_types=<factory>, attributes_to_exclude_in_simplification=<factory>, save_gpkg=False, reuse_network_output=False)[source]#

Bases: object

Represents a section of the transport network.

Parameters:
  • directed (bool) – Whether the graph of the network should be directed. Default is False.

  • source (SourceEnum) – Source of the network data. Default is SourceEnum.INVALID.

  • primary_file (Optional[Path]) – If source is set to SourceEnum.SHAPEFILE, provide a list of shapefiles for the network.

  • diversion_file (Optional[Path]) – List of diversion files.

  • file_id (str) – field name of the ID attribute in the shapefile for network creating with a shapefile as source.

  • link_type_column (Optional[str]) – Attribute name in a GeoDataFrame or shapefile that defines link type (e.g. type of road). Default is 'highway'.

  • polygon (Optional[Path]) – If source is set to SourceEnum.OSM_DOWNLOAD, path to a shapefile polygon to clip the network.

  • network_type (NetworkTypeEnum) – Type of network. Default is NetworkTypeEnum.NONE.

  • road_types (list[RoadTypeEnum]) – List of road types to download from OSM if source is set to SourceEnum.OSM_DOWNLOAD.

  • attributes_to_exclude_in_simplification (Optional[list[str]]) – List of attributes not to simplify.

  • save_gpkg (bool) – Whether to save a GeoPackage file of the network in the output_graph folder. Default is False.

  • reuse_network_output (bool)

reuse_network_output: bool = False#
class HazardSection(hazard_map=<factory>, hazard_id='', hazard_field_name='', aggregate_wl=<factory>, hazard_crs='', overlay_segmented_network=True)[source]#

Bases: object

Represents a section of the transport network.

Parameters:
  • hazard_map (list[Path]) – list of path to raster files representing the hazard maps, for which the hazard overlay will be performed on the network.

  • hazard_id (Optional[str]) – Identifier for the hazard section.

  • hazard_field_name (Optional[str]) – Name of the field in the hazard map to be used for the overlay.

  • aggregate_wl (AggregateWlEnum) – If a network link intersects multiple cells of the hazard map, choose which method to aggregate hazard intensity levels. Default is AggregateWlEnum.NONE.

  • hazard_crs (str) – Coordinate reference system of the hazard maps.

  • overlay_segmented_network (Optional[bool]) – If False no overlay of the segmented network will be created. Default is True.

class CleanupSection(snapping_threshold=False, pruning_threshold=False, segmentation_length=nan, merge_lines=False, cut_at_intersections=False, delete_duplicate_nodes=False)[source]#

Bases: object

Parameters:
  • snapping_threshold (bool)

  • pruning_threshold (bool)

  • segmentation_length (float)

  • merge_lines (bool)

  • cut_at_intersections (bool)

  • delete_duplicate_nodes (bool)

class OriginsDestinationsSection(origins=None, destinations=None, origin_count=None, origin_out_fraction=1, category='', region=None, region_var='')[source]#

Bases: object

Parametrization for origins and destinations.

Parameters:
  • origins (Optional[Path]) – Path to a shapefile or other supported file containing origin points.

  • destinations (Optional[Path]) – Path to a shapefile or other supported file containing destination points.

  • origins_names – Shortcut name for the origins, used in output files.

  • destinations_names – Shortcut name for the destinations, used in output files.

  • id_name_origin_destination – Field name of the ID attribute in both the origins and destinations files. Mandatory field.

  • origin_count (Optional[str]) – Field name of the attribute in the origins file that contains the count of things/people at the origin. Mandatory field.

  • origin_out_fraction (int) – Fraction of things/people going out of the origin to the destination. Default is 1.

  • category (Optional[str]) – (Field name of the attribute in the origins and destinations files that contains the category of the origin/destination.

  • region (Optional[Path]) – (Optional) Path to a shapefile or other supported file containing the region polygon.

  • region_var (Optional[str]) – (Optional) Field name of the attribute in the region file that contains the region variable.

class IsolationSection(locations='')[source]#

Bases: object

Parameters:

locations (str)

class ProjectSection(name='')[source]#

Bases: object

Parameters:

name (str)

class NetworkConfigData(root_path=None, static_path=None, crs=<factory>, project=<factory>, network=<factory>, origins_destinations=<factory>, isolation=<factory>, hazard=<factory>, cleanup=<factory>)[source]#

Bases: ConfigDataProtocol

Data class for network configuration data.

Holds configuration for a transport network, including paths, coordinate reference system (CRS), and various sections such as project details, network specifics, origins and destinations, isolation points, hazard information, and cleanup options.

Parameters:
  • root_path (Path) – The root directory path for the project.

  • static_path (Path) – The static files directory path for the project. Recommended to be: root_path/static.

  • crs (pyproj.CRS, default EPSG:4326) – The coordinate reference system used in the project.

  • project (Optional[ProjectSection]) – Section containing project details.

  • network (NetworkSection) – Section containing network specifics.

  • origins_destinations (Optional[OriginsDestinationsSection]) – Section containing origins and destinations details. Required only for analysis types that need about accessibility.

  • isolation (Optional[IsolationSection]) – Section containing isolation points details. Required only for analyses about isolated locations.

  • hazard (Optional[HazardSection]) – Section containing hazard information. Required only for analysis with a hazard component/map.

  • cleanup (Optional[CleanupSection]) – Section containing cleanup options.

static get_data_output(ini_file)[source]#
Return type:

Path

Parameters:

ini_file (Path)

property network_dir: Path | None#
property output_graph_dir: Path | None#
to_dict()[source]#

Returns all defined properties as a raw dictionary, converting all custom classes and types.

Return type:

dict

Returns:

dict: Dictionary representing the ConfigDataProtocol instance.