Skip to content

Commit

Permalink
wraps alt clean
Browse files Browse the repository at this point in the history
  • Loading branch information
songololo committed Jun 17, 2024
1 parent a5c2580 commit 5754619
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 34 deletions.
11 changes: 10 additions & 1 deletion pdm.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "cityseer"
version = '4.14.0b3'
version = '4.14.0'
description = "Computational tools for network-based pedestrian-scale urban analysis"
readme = "README.md"
requires-python = ">=3.10, <3.13"
Expand Down Expand Up @@ -106,6 +106,7 @@ dev = [
"pdoc>=14.1.0",
"docstring-parser>=0.15",
"dominate>=2.8.0",
"utm>=0.7.0",
]

[build-system]
Expand Down
5 changes: 1 addition & 4 deletions pysrc/cityseer/tools/graphs.py
Original file line number Diff line number Diff line change
Expand Up @@ -503,9 +503,7 @@ def nx_iron_edges(
elif edge_geom.length > 150:
edge_geom = edge_geom.simplify(5) # type: ignore
# flatten if a relatively contained road but large angular change
elif simple_geom.buffer(15).contains(edge_geom) and max_angle > 60:
edge_geom = simple_geom
elif simple_geom.buffer(7.5).contains(edge_geom) and max_angle > 30:
elif simple_geom.buffer(15).contains(edge_geom) and max_angle > 20:
edge_geom = simple_geom
g_multi_copy[start_nd_key][end_nd_key][edge_idx]["geom"] = edge_geom
# straightening parallel edges can create duplicates
Expand Down Expand Up @@ -545,7 +543,6 @@ def _squash_adjacent(
crossings = 0
# compute node straight-through-angles
nd_x_y = (nx_multigraph.nodes[nd_key]["x"], nx_multigraph.nodes[nd_key]["y"])
crossings = 0
for nb_nd_key_a in nx.neighbors(nx_multigraph, nd_key):
for nb_edge_data_a in nx_multigraph[nd_key][nb_nd_key_a].values():
geom_a = nb_edge_data_a["geom"]
Expand Down
54 changes: 26 additions & 28 deletions pysrc/cityseer/tools/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,8 +328,7 @@ def osm_graph_from_poly(
(
way["highway"]
["area"!="yes"]
["highway"!~"motorway|motorway_link|bus_guideway|busway|escape|raceway|proposed|planned|abandoned|platform|construction|emergency_bay|rest_area"]
["tunnel"!="yes"]
["highway"!~"bus_guideway|busway|escape|raceway|proposed|planned|abandoned|platform|construction|emergency_bay|rest_area"]
["footway"!="sidewalk"]
["service"!~"parking_aisle|driveway|drive-through|slipway"]
["amenity"!~"charging_station|parking|fuel|motorcycle_parking|parking_entrance|parking_space"]
Expand Down Expand Up @@ -357,32 +356,31 @@ def osm_graph_from_poly(
graph_crs = graphs.nx_remove_filler_nodes(graph_crs)
if simplify:
graph_crs = graphs.nx_remove_dangling_nodes(graph_crs, remove_disconnected=remove_disconnected)
graph_crs = graphs.nx_consolidate_nodes(
graph_crs,
buffer_dist=crawl_consolidate_dist,
crawl=True,
contains_buffer_dist=contains_buffer_dist,
)
graph_crs = graphs.nx_split_opposing_geoms(
graph_crs, buffer_dist=parallel_consolidate_dist, contains_buffer_dist=contains_buffer_dist
)
graph_crs = graphs.nx_consolidate_nodes(
graph_crs,
buffer_dist=parallel_consolidate_dist,
contains_buffer_dist=contains_buffer_dist,
)
graph_crs = graphs.nx_remove_filler_nodes(graph_crs)
if iron_edges:
graph_crs = graphs.nx_iron_edges(graph_crs)
graph_crs = graphs.nx_split_opposing_geoms(
graph_crs, buffer_dist=parallel_consolidate_dist, contains_buffer_dist=contains_buffer_dist
)
graph_crs = graphs.nx_consolidate_nodes(
graph_crs,
buffer_dist=parallel_consolidate_dist,
contains_buffer_dist=contains_buffer_dist,
)
graph_crs = graphs.nx_remove_filler_nodes(graph_crs)
for hwy_keys, split_dist, consol_dist, cent_by_itx in [
(["motorway"], 30, 15, False),
(["trunk"], parallel_consolidate_dist, crawl_consolidate_dist, True),
(["primary"], parallel_consolidate_dist, crawl_consolidate_dist, True),
(["secondary"], parallel_consolidate_dist, crawl_consolidate_dist, True),
(["tertiary"], parallel_consolidate_dist, crawl_consolidate_dist, True),
(["residential"], parallel_consolidate_dist, crawl_consolidate_dist, True),
(None, parallel_consolidate_dist, crawl_consolidate_dist, False),
]:
contains_buffer_dist = max(split_dist, 25)
graph_crs = graphs.nx_split_opposing_geoms(
graph_crs,
buffer_dist=split_dist,
osm_hwy_target_tags=hwy_keys,
contains_buffer_dist=contains_buffer_dist,
)
graph_crs = graphs.nx_consolidate_nodes(
graph_crs,
buffer_dist=consol_dist,
crawl=True,
osm_hwy_target_tags=hwy_keys,
centroid_by_itx=cent_by_itx,
contains_buffer_dist=contains_buffer_dist,
)
graph_crs = graphs.nx_remove_filler_nodes(graph_crs)
if iron_edges:
graph_crs = graphs.nx_iron_edges(graph_crs)

Expand Down

0 comments on commit 5754619

Please sign in to comment.