cityImage.clean_network#

cityImage.clean_network(nodes_gdf, edges_gdf, dead_ends=False, remove_islands=True, same_vertexes_edges=True, self_loops=False, fix_topology=False, preserve_direction=False, nodes_to_keep_regardless=[])[source]#

It calls a series of functions to clean nodes and edges GeoDataFrames. It handles:

  • pseudo-nodes;

  • duplicate-geometries (nodes and edges);

  • disconnected islands - optional;

  • edges with different geometry but same nodes - optional;

  • dead-ends - optional;

  • self-loops - optional;

  • toplogy issues - optional.

Parameters:
  • nodes_gdf (Point GeoDataFrame) – The nodes (junctions) GeoDataFrame.

  • edges_gdf (LineString GeoDataFrame) – The street segments GeoDataFrame.

  • dead_ends (bool) – When true remove dead ends.

  • remove_islands (bool) – When true checks the existence of disconnected islands within the network and deletes corresponding graph components.

  • same_vertexes_edges (bool) – When true, it considers as duplicates couple of edges with same vertexes but different geometry. If one of the edges is 1% longer than the other, the longer is deleted; otherwise a center line is built to replace the same vertexes edges.

  • self_loops (bool) – When true, removes genuine self-loops.

  • fix_topology (bool) – When true, it breaks lines at intersections with other lines in the streets GeoDataFrame.

  • preserve_direction (bool) – When true, it does not consider segments with same coordinates list, but different directions, as identical. When false, it does and therefore considers them as duplicated geometries.

  • nodes_to_keep_regardless (list) – List of nodeIDs representing nodes to keep, even when pseudo-nodes (e.g. stations, when modelling transport networks).

Returns:

nodes_gdf, edges_gdf – The cleaned junctions and street segments GeoDataFrames.

Return type:

tuple of GeoDataFrames