Skip to content

Commit

Permalink
drop short self loops on imports
Browse files Browse the repository at this point in the history
  • Loading branch information
songololo committed May 14, 2024
1 parent b6e2361 commit 0334a50
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 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.13.2'
version = '4.13.3'
description = "Computational tools for network-based pedestrian-scale urban analysis"
readme = "README.md"
requires-python = ">=3.10, <3.13"
Expand Down
7 changes: 5 additions & 2 deletions pysrc/cityseer/tools/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -1142,10 +1142,13 @@ def _node_key(node_coords: list[float]):
edge_geom = edge_row[geom_key]
coords_a = edge_geom.coords[0]
node_key_a = _node_key(coords_a)
if node_key_a not in g_multi:
g_multi.add_node(node_key_a, x=coords_a[0], y=coords_a[1])
coords_b = edge_geom.coords[-1]
node_key_b = _node_key(coords_b)
# drop short self-loops
if node_key_a == node_key_b and edge_geom.length < 5:
continue
if node_key_a not in g_multi:
g_multi.add_node(node_key_a, x=coords_a[0], y=coords_a[1])
if node_key_b not in g_multi:
g_multi.add_node(node_key_b, x=coords_b[0], y=coords_b[1])
g_multi.add_edge(node_key_a, node_key_b, momepy_edge_idx=edge_idx, geom=edge_geom)
Expand Down

0 comments on commit 0334a50

Please sign in to comment.