Skip to content

Commit

Permalink
changes parameter names for consistency re epsg vs crs
Browse files Browse the repository at this point in the history
  • Loading branch information
songololo committed Dec 31, 2023
1 parent 51c9733 commit dd93cad
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
8 changes: 4 additions & 4 deletions docs/src/pages/rustalgos/rustalgos.md
Original file line number Diff line number Diff line change
Expand Up @@ -2726,22 +2726,22 @@ datapoints are not located with high spatial precision.



<span class="name">node_lives</span><span class="annotation">: list[bool]</span>
<span class="name">node_xs</span><span class="annotation">: list[float]</span>




<span class="name">node_ys</span><span class="annotation">: list[float]</span>
<span class="name">node_xys</span><span class="annotation">: list[tuple[float, float]]</span>




<span class="name">node_xys</span><span class="annotation">: list[tuple[float, float]]</span>
<span class="name">node_lives</span><span class="annotation">: list[bool]</span>




<span class="name">node_xs</span><span class="annotation">: list[float]</span>
<span class="name">node_ys</span><span class="annotation">: list[float]</span>



Expand Down
4 changes: 2 additions & 2 deletions docs/src/pages/tools/io.md
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ builds a graph automatically.
<span class="pa"> shapely.geometry.polygon.Polygon</span>
</div>
<div class="param">
<span class="pn">poly_epsg_code</span>
<span class="pn">poly_crs_code</span>
<span class="pc">:</span>
<span class="pa"> int | str = 4326</span>
</div>
Expand Down Expand Up @@ -407,7 +407,7 @@ builds a graph automatically.

<div class="param-set">
<div class="def">
<div class="name">poly_epsg_code</div>
<div class="name">poly_crs_code</div>
<div class="type">int | str</div>
</div>
<div class="desc">
Expand Down
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.8.1'
version = '4.9.0'
description = "Computational tools for network-based pedestrian-scale urban analysis"
readme = "README.md"
requires-python = ">=3.10, <3.12"
Expand Down
10 changes: 5 additions & 5 deletions pysrc/cityseer/tools/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ def fetch_osm_network(osm_request: str, timeout: int = 300, max_tries: int = 3)

def osm_graph_from_poly(
poly_geom: geometry.Polygon,
poly_epsg_code: int | str = 4326,
poly_crs_code: int | str = 4326,
to_crs_code: int | str | None = None,
custom_request: str | None = None,
simplify: bool = True,
Expand All @@ -238,7 +238,7 @@ def osm_graph_from_poly(
----------
poly_geom: shapely.Polygon
A shapely Polygon representing the extents for which to fetch the OSM network.
poly_epsg_code: int | str
poly_crs_code: int | str
An integer representing a valid EPSG code for the provided polygon. For example, [4326](https://epsg.io/4326) if
using WGS lng / lat, or [27700](https://epsg.io/27700) if using the British National Grid.
to_crs_code: int | str
Expand Down Expand Up @@ -305,12 +305,12 @@ def osm_graph_from_poly(
```
"""
if poly_epsg_code is not None and not isinstance(poly_epsg_code, (int, str)): # type: ignore
raise TypeError('Please provide "poly_epsg_code" parameter as int or str')
if poly_crs_code is not None and not isinstance(poly_crs_code, (int, str)): # type: ignore
raise TypeError('Please provide "poly_crs_code" parameter as int or str')
if to_crs_code is not None and not isinstance(to_crs_code, (int, str)):
raise TypeError('Please provide "to_crs_code" parameter as int or str')
# format for OSM query
in_transformer = Transformer.from_crs(poly_epsg_code, 4326, always_xy=True)
in_transformer = Transformer.from_crs(poly_crs_code, 4326, always_xy=True)
coords = [in_transformer.transform(lng, lat) for lng, lat in poly_geom.exterior.coords]
geom_osm = str.join(" ", [f"{lat} {lng}" for lng, lat in coords])
if custom_request is not None:
Expand Down
2 changes: 1 addition & 1 deletion tests/tools/test_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ def test_osm_graph_from_poly():
# 32630 corresponds to UTM 30N
poly_utm, utm_epsg = io.buffered_point_poly(LNG, LAT, BUFFER, projected=True)
assert utm_epsg == 32630
network_from_utm = io.osm_graph_from_poly(poly_utm, poly_epsg_code=utm_epsg, simplify=False)
network_from_utm = io.osm_graph_from_poly(poly_utm, poly_crs_code=utm_epsg, simplify=False)
# visual check for debugging
# plot.plot_nx(network_from_utm)
assert isinstance(network_from_utm, nx.MultiGraph)
Expand Down

0 comments on commit dd93cad

Please sign in to comment.