Skip to content

Commit

Permalink
fixes osmnx conversion node keys cast to str
Browse files Browse the repository at this point in the history
  • Loading branch information
songololo committed Nov 20, 2024
1 parent 72aa7b3 commit c00b5e2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 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.0b13'
version = '4.16.0b14'
description = "Computational tools for network-based pedestrian-scale urban analysis"
readme = "README.md"
requires-python = ">=3.10, <3.14"
Expand Down
7 changes: 6 additions & 1 deletion pysrc/cityseer/tools/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -659,7 +659,8 @@ def _process_node(nd_key: NodeKey) -> tuple[float, float]:
if "y" not in nx_multidigraph.nodes[nd_key]:
raise KeyError(f'Encountered node missing "y" coordinate attribute for node {nd_key}.')
y: float = nx_multidigraph.nodes[nd_key]["y"]
# add attributes if necessary
# add node and attributes if necessary
nd_key = str(nd_key)
if nd_key not in g_multi:
g_multi.add_node(nd_key, x=x, y=y)
if node_attributes is not None:
Expand Down Expand Up @@ -706,6 +707,10 @@ def _process_node(nd_key: NodeKey) -> tuple[float, float]:
# snap starting and ending coords to avoid rounding error issues
geom_coords = util.snap_linestring_startpoint(geom_coords, (s_x, s_y))
geom_coords = util.snap_linestring_endpoint(geom_coords, (e_x, e_y))
# convert keys to str
start_nd_key = str(start_nd_key)
end_nd_key = str(end_nd_key)
# new graph expects str
g_multi.add_edge(start_nd_key, end_nd_key, key=edge_idx, geom=geometry.LineString(geom_coords))
if edge_attributes is not None:
for edge_att in edge_attributes:
Expand Down

0 comments on commit c00b5e2

Please sign in to comment.