Skip to content

Commit

Permalink
tweaks default clean params
Browse files Browse the repository at this point in the history
  • Loading branch information
songololo committed Nov 25, 2024
1 parent b932c3c commit d4837fb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "cityseer"
version = '4.16.2'
version = '4.16.3'
description = "Computational tools for network-based pedestrian-scale urban analysis"
readme = "README.md"
requires-python = ">=3.10, <3.14"
Expand Down
19 changes: 8 additions & 11 deletions pysrc/cityseer/tools/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ def _extract_gdf(gdf):
else:
ways_gdf = gpd.GeoDataFrame(columns=gdf.columns, crs=gdf.crs) # type: ignore
# extract relations
if "f" in gdf.index.names and "relation" in gdf.index.get_level_values("element"):
if "element" in gdf.index.names and "relation" in gdf.index.get_level_values("element"):
relations_gdf = gdf.xs("relation", level="element", drop_level=True)
relations_gdf = relations_gdf.explode(index_parts=False).reset_index(drop=True)
relations_gdf = relations_gdf[relations_gdf.geometry.type == "Polygon"]
Expand Down Expand Up @@ -441,8 +441,8 @@ def osm_graph_from_poly(
graph_crs = graphs.nx_remove_dangling_nodes(graph_crs, despine=0, remove_disconnected=remove_disconnected)
# clean by highway types - leave motorway and trunk as is
for dist, tags, simplify_line_angles in (
(24, ["primary"], 45), # , "primary_link"
(20, ["primary", "secondary"], 45), # , "secondary_link"
(20, ["primary"], 45), # , "primary_link"
(18, ["primary", "secondary"], 45), # , "secondary_link"
(16, ["primary", "secondary", "tertiary"], 45), # , "tertiary_link"
):
graph_crs = graphs.nx_split_opposing_geoms(
Expand All @@ -455,9 +455,9 @@ def osm_graph_from_poly(
simplify_line_angles=simplify_line_angles,
)
for dist, tags, simplify_line_angles in (
(18, ["primary"], 95), # , "primary_link"
(16, ["primary", "secondary"], 95), # , "secondary_link"
(14, ["primary", "secondary", "tertiary"], 95), # , "tertiary_link"
(20, ["primary"], 95), # , "primary_link"
(18, ["primary", "secondary"], 95), # , "secondary_link"
(16, ["primary", "secondary", "tertiary"], 95), # , "tertiary_link"
):
graph_crs = graphs.nx_consolidate_nodes(
graph_crs,
Expand All @@ -471,17 +471,14 @@ def osm_graph_from_poly(
graph_crs = graphs.nx_remove_filler_nodes(graph_crs)
# do smaller scale cleaning
tags = [
"primary",
"secondary",
"tertiary",
"residential",
"service",
"cycleway",
"busway",
"footway",
"path",
"living_street",
]
dists = [6, 12]
dists = [5, 10]
simplify_angles = 95
#
for dist in dists:
Expand Down

0 comments on commit d4837fb

Please sign in to comment.