diff --git a/docs/public/images/graph_clean.png b/docs/public/images/graph_clean.png index 7e6fc436..d78df366 100644 Binary files a/docs/public/images/graph_clean.png and b/docs/public/images/graph_clean.png differ diff --git a/pyproject.toml b/pyproject.toml index 0fb5217b..09fe183c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "cityseer" -version = '4.17.0' +version = '4.17.1' description = "Computational tools for network-based pedestrian-scale urban analysis" readme = "README.md" requires-python = ">=3.10, <3.14" diff --git a/pysrc/cityseer/tools/graphs.py b/pysrc/cityseer/tools/graphs.py index 3f65ea4e..d26bb761 100644 --- a/pysrc/cityseer/tools/graphs.py +++ b/pysrc/cityseer/tools/graphs.py @@ -562,7 +562,7 @@ def nx_iron_edges( nx_multigraph: MultiGraph, simplify_by_max_angle: int = 120, min_self_loop_length: int = 100, - max_foot_tunnel_length: int = 50, + max_foot_tunnel_length: int = 100, ) -> MultiGraph: """ Simplifies edges. @@ -577,7 +577,7 @@ def nx_iron_edges( min_self_loop_length: int Maximum self loop length to permit for a given edge. max_foot_tunnel_length: int - Maximum tunnel length to permit for non motorised edges. + Maximum tunnel length to permit for non motorised edges. Default of 100m. Returns ------- @@ -646,7 +646,7 @@ def nx_iron_edges( "tertiary", "tertiary_link", "residential", - "living_street", + # "living_street", # intentional - e.g. barcelona # "service", # intentional ] ) @@ -654,7 +654,7 @@ def nx_iron_edges( def nx_deduplicate_edges( nx_multigraph: MultiGraph, - dissolve_distance: int = 12, + dissolve_distance: int = 20, max_ang_diff: int = 20, ) -> MultiGraph: """ @@ -670,7 +670,7 @@ def nx_deduplicate_edges( A `networkX` `MultiGraph` in a projected coordinate system, containing `x` and `y` node attributes, and `geom` edge attributes containing `LineString` geoms. dissolve_distance: int - A distance to use when searching for adjacent edges. 12m by default. + A distance to use when searching for adjacent edges. 20m by default. max_ang_diff: int Only count a nearby adjacent edge as duplicitous if the angular difference between edges is less than `max_ang_diff`. 20 degrees by default. diff --git a/pysrc/cityseer/tools/io.py b/pysrc/cityseer/tools/io.py index eeef066c..bdb6ec0b 100644 --- a/pysrc/cityseer/tools/io.py +++ b/pysrc/cityseer/tools/io.py @@ -257,7 +257,7 @@ def _auto_clean_network( green_service_roads: bool = False, ) -> nx.MultiGraph: # deduplicate by hierarchy - G = graphs.nx_deduplicate_edges(G) + G = graphs.nx_deduplicate_edges(G, dissolve_distance=20, max_ang_diff=20) # parks parks_gdf = ox.features_from_polygon( geom_wgs, @@ -295,6 +295,7 @@ def _auto_clean_network( for start_node_key, end_node_key, edge_key, edge_data in tqdm( # type: ignore G.edges(keys=True, data=True), # type: ignore total=G.number_of_edges(), + disable=config.QUIET_MODE, ): edge_geom = edge_data["geom"] if "footway" in edge_data["highways"]: @@ -475,7 +476,7 @@ def _auto_clean_network( ) G = graphs.nx_remove_filler_nodes(G) G = graphs.nx_merge_parallel_edges(G, merge_edges_by_midline=True, contains_buffer_dist=50) - G = graphs.nx_iron_edges(G, min_self_loop_length=100, max_foot_tunnel_length=50) + G = graphs.nx_iron_edges(G, min_self_loop_length=100, max_foot_tunnel_length=100) # do this last to clean up any orphaned sub components G = graphs.nx_remove_dangling_nodes(G, despine=25) @@ -708,6 +709,8 @@ def get_merged_nd_keys(_idx: int) -> tuple[str, str]: levels = tags["level"].split(":") elif ";" in tags["level"]: levels = tags["level"].split(";") + elif "," in tags["level"]: + levels = tags["level"].split(",") else: levels = [tags["level"]] levels = [int(round(float(level))) for level in levels]