Skip to content

Commit

Permalink
fixes projection for marking footways
Browse files Browse the repository at this point in the history
  • Loading branch information
songololo committed Nov 19, 2024
1 parent 2d1c9aa commit 72aa7b3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 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.0b12'
version = '4.16.0b13'
description = "Computational tools for network-based pedestrian-scale urban analysis"
readme = "README.md"
requires-python = ">=3.10, <3.14"
Expand Down
14 changes: 9 additions & 5 deletions pysrc/cityseer/tools/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -366,11 +366,13 @@ def osm_graph_from_poly(
osm_response = fetch_osm_network(request, timeout=timeout, max_tries=max_tries)
# build graph
graph_wgs = nx_from_osm(osm_json=osm_response.text) # type: ignore
# cast to UTM
if to_crs_code is not None:
graph_crs = nx_epsg_conversion(graph_wgs, 4326, to_crs_code)
else:
graph_crs = nx_wgs_to_utm(graph_wgs)
# extract CRS code if necessary
if to_crs_code is None:
# need CRS code so do this manually
nd_key = list(graph_wgs.nodes())[0]
to_crs_code = util.extract_utm_epsg_code(graph_wgs.nodes[nd_key]["x"], graph_wgs.nodes[nd_key]["y"])
# project
graph_crs = nx_epsg_conversion(graph_wgs, 4326, to_crs_code)
graph_crs = graphs.nx_simple_geoms(graph_crs)
graph_crs = graphs.nx_remove_filler_nodes(graph_crs)
if simplify:
Expand All @@ -383,6 +385,7 @@ def osm_graph_from_poly(
},
)
park_area_gdf = _extract_gdf(parks_gdf)
park_area_gdf = park_area_gdf.to_crs(to_crs_code)
# plazas
plazas_gdf = ox.features_from_polygon(
geom_wgs,
Expand All @@ -391,6 +394,7 @@ def osm_graph_from_poly(
},
)
plaza_area_gdf = _extract_gdf(plazas_gdf)
plaza_area_gdf = plaza_area_gdf.to_crs(to_crs_code)
# use STR Tree for performance
parks_buff_str_tree = STRtree(park_area_gdf.buffer(5).geometry.to_list())
plaza_str_tree = STRtree(plaza_area_gdf.geometry.to_list())
Expand Down

0 comments on commit 72aa7b3

Please sign in to comment.