Skip to content

Commit

Permalink
Merge pull request #134 from benchmark-urbanism/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
songololo authored Nov 27, 2024
2 parents 63dd0f3 + 9061855 commit b68f1f4
Show file tree
Hide file tree
Showing 23 changed files with 352 additions and 201 deletions.
1 change: 0 additions & 1 deletion docs/package-lock.json

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

25 changes: 4 additions & 21 deletions docs/plots/plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,9 @@
buffer = 1250
poly_wgs, _ = io.buffered_point_poly(lng, lat, buffer)
graph_raw = io.osm_graph_from_poly(poly_wgs, simplify=False)
graph_utm = io.osm_graph_from_poly(poly_wgs, simplify=True, iron_edges=True)
graph_utm = io.osm_graph_from_poly(poly_wgs, simplify=True)
# plot buffer
buffered_point, _ = io.buffered_point_poly(lng, lat, 750, projected=True)
buffered_point, _ = io.buffered_point_poly(lng, lat, 900, projected=True)
min_x, min_y, max_x, max_y = buffered_point.bounds


Expand All @@ -116,25 +116,8 @@ def simple_plot(_G, _path, plot_geoms=True):
)


simple_plot(graph_raw, f"{IMAGES_PATH}/graph_cleaning_1.{FORMAT}", plot_geoms=False)
simple_plot(graph_utm, f"{IMAGES_PATH}/graph_cleaning_1b.{FORMAT}")

graph_utm = graphs.nx_simple_geoms(graph_raw)
graph_utm = graphs.nx_remove_filler_nodes(graph_utm)
graph_utm = graphs.nx_remove_dangling_nodes(graph_utm, despine=15, remove_disconnected=10)
simple_plot(graph_utm, f"{IMAGES_PATH}/graph_cleaning_2.{FORMAT}")
# first pass of consolidation
graph_utm = graphs.nx_consolidate_nodes(graph_utm, buffer_dist=15, crawl=True)
simple_plot(graph_utm, f"{IMAGES_PATH}/graph_cleaning_3.{FORMAT}")
# split opposing line geoms to facilitate parallel merging
graph_utm = graphs.nx_split_opposing_geoms(graph_utm, buffer_dist=15)
simple_plot(graph_utm, f"{IMAGES_PATH}/graph_cleaning_4.{FORMAT}")
# second pass of consolidation
graph_utm = graphs.nx_consolidate_nodes(graph_utm, buffer_dist=15, crawl=False, neighbour_policy="indirect")
simple_plot(graph_utm, f"{IMAGES_PATH}/graph_cleaning_5.{FORMAT}")
# iron edges
graph_utm = graphs.nx_iron_edges(graph_utm)
simple_plot(graph_utm, f"{IMAGES_PATH}/graph_cleaning_6.{FORMAT}")
simple_plot(graph_raw, f"{IMAGES_PATH}/graph_raw.{FORMAT}")
simple_plot(graph_utm, f"{IMAGES_PATH}/graph_clean.{FORMAT}")
# LAYERS MODULE
# show assignment to network
# random seed 25
Expand Down
Binary file modified docs/public/images/assignment.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/public/images/assignment_decomposed.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/public/images/assignment_plot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/public/images/betas.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/public/images/graph.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/public/images/graph_clean.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/public/images/graph_colour.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/public/images/graph_decomposed.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/public/images/graph_dual.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/public/images/graph_example.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/public/images/graph_raw.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/public/images/graph_simple.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/public/images/intro_mixed_uses.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/public/images/intro_segment_harmonic.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 7 additions & 11 deletions docs/src/pages/rustalgos/rustalgos.md
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,7 @@ Overriding the default $w_{min}$ will adjust the $d_{max}$ accordingly, for exam
</div>
<span class="pt">)-&gt;[</span>
<span class="pr">list[int]</span>
<span class="pr">list[float</span>
<span class="pr">list[float]</span>
<span class="pt">]</span>
</div>
</div>
Expand Down Expand Up @@ -1903,7 +1903,7 @@ datapoints are not located with high spatial precision.
</div>
<span class="pt">)-&gt;[</span>
<span class="pr">list[int]</span>
<span class="pr">NodeVisit</span>
<span class="pr">NodeVisit]</span>
<span class="pt">]</span>
</div>
</div>
Expand Down Expand Up @@ -1940,7 +1940,7 @@ datapoints are not located with high spatial precision.
</div>
<span class="pt">)-&gt;[</span>
<span class="pr">list[int]</span>
<span class="pr">NodeVisit</span>
<span class="pr">NodeVisit]</span>
<span class="pt">]</span>
</div>
</div>
Expand Down Expand Up @@ -1979,7 +1979,7 @@ datapoints are not located with high spatial precision.
<span class="pr">list[int]</span>
<span class="pr">list[int]</span>
<span class="pr">NodeVisit]</span>
<span class="pr">EdgeVisit</span>
<span class="pr">EdgeVisit]</span>
<span class="pt">]</span>
</div>
</div>
Expand Down Expand Up @@ -2807,7 +2807,7 @@ datapoints are not located with high spatial precision.



<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>



Expand All @@ -2822,7 +2822,7 @@ datapoints are not located with high spatial precision.



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



Expand Down Expand Up @@ -2999,7 +2999,6 @@ datapoints are not located with high spatial precision.
<span class="pa"> bool = False</span>
</div>
<span class="pt">)-&gt;[</span>
<span class="pr">Union[Buffer</span>
<span class="pr">Any]]</span>
<span class="pr">Any]]]</span>
<span class="pr">bool</span>
Expand All @@ -3009,7 +3008,6 @@ datapoints are not located with high spatial precision.
<span class="pr">str</span>
<span class="pr">bytes</span>
<span class="pr">_NestedSequence[bool | int | float | complex | str | bytes]]</span>
<span class="pr">Union[Buffer</span>
<span class="pr">Any]]</span>
<span class="pr">Any]]]</span>
<span class="pr">bool</span>
Expand All @@ -3019,7 +3017,6 @@ datapoints are not located with high spatial precision.
<span class="pr">str</span>
<span class="pr">bytes</span>
<span class="pr">_NestedSequence[bool | int | float | complex | str | bytes]]</span>
<span class="pr">Union[Buffer</span>
<span class="pr">Any]]</span>
<span class="pr">Any]]]</span>
<span class="pr">bool</span>
Expand All @@ -3028,7 +3025,7 @@ datapoints are not located with high spatial precision.
<span class="pr">complex</span>
<span class="pr">str</span>
<span class="pr">bytes</span>
<span class="pr">_NestedSequence[bool | int | float | complex | str | bytes</span>
<span class="pr">_NestedSequence[bool | int | float | complex | str | bytes]]</span>
<span class="pt">]</span>
</div>
</div>
Expand Down Expand Up @@ -3072,7 +3069,6 @@ datapoints are not located with high spatial precision.
<span class="pa"> bool = False</span>
</div>
<span class="pt">)-&gt;[</span>
<span class="pr">Union[Buffer</span>
<span class="pr">dtype[Any]]</span>
<span class="pr">dtype[Any]]]</span>
<span class="pr">bool</span>
Expand Down
36 changes: 33 additions & 3 deletions docs/src/pages/tools/graphs.md
Original file line number Diff line number Diff line change
Expand Up @@ -331,11 +331,21 @@ side-effects as a function of varied node intensities when computing network cen


<div class="content">
<span class="name">nx_iron_edges</span><div class="signature">
<span class="name">nx_iron_edges</span><div class="signature multiline">
<span class="pt">(</span>
<div class="param">
<span class="pn">nx_multigraph</span>
</div>
<div class="param">
<span class="pn">simplify_by_angle</span>
<span class="pc">:</span>
<span class="pa"> int = 100</span>
</div>
<div class="param">
<span class="pn">min_self_loop_length</span>
<span class="pc">:</span>
<span class="pa"> int = 100</span>
</div>
<span class="pt">)</span>
</div>
</div>
Expand All @@ -353,6 +363,26 @@ side-effects as a function of varied node intensities when computing network cen
A `networkX` `MultiGraph` in a projected coordinate system, containing `x` and `y` node attributes, and `geom` edge attributes containing `LineString` geoms.</div>
</div>

<div class="param-set">
<div class="def">
<div class="name">simplify_by_angle</div>
<div class="type">int</div>
</div>
<div class="desc">

The maximum angle to permit for a given edge. Angles greater than this will be reduced.</div>
</div>

<div class="param-set">
<div class="def">
<div class="name">min_self_loop_length</div>
<div class="type">int</div>
</div>
<div class="desc">

Maximum self loop length to permit for a given edge.</div>
</div>

### Returns
<div class="param-set">
<div class="def">
Expand Down Expand Up @@ -578,9 +608,9 @@ side-effects as a function of varied node intensities when computing network cen

See the guide on [graph cleaning](/guide#graph-cleaning) for more information.

![Example raw graph from OSM](/images/graph_cleaning_1.png) _The pre-consolidation OSM street network for Soho, London. © OpenStreetMap contributors._
![Example raw graph from OSM](/images/graph_raw.png) _The pre-consolidation OSM street network for Soho, London. © OpenStreetMap contributors._

![Example cleaned graph](/images/graph_cleaning_5.png) _The consolidated OSM street network for Soho, London. © OpenStreetMap contributors._
![Example cleaned graph](/images/graph_clean.png) _The consolidated OSM street network for Soho, London. © OpenStreetMap contributors._

</div>

Expand Down
75 changes: 75 additions & 0 deletions docs/src/pages/tools/io.md
Original file line number Diff line number Diff line change
Expand Up @@ -351,11 +351,36 @@ builds a graph automatically.
<span class="pc">:</span>
<span class="pa"> bool = True</span>
</div>
<div class="param">
<span class="pn">final_clean_distances</span>
<span class="pc">:</span>
<span class="pa"> tuple[int, ...] = (6, 12)</span>
</div>
<div class="param">
<span class="pn">remove_disconnected</span>
<span class="pc">:</span>
<span class="pa"> int = 100</span>
</div>
<div class="param">
<span class="pn">cycleways</span>
<span class="pc">:</span>
<span class="pa"> bool = True</span>
</div>
<div class="param">
<span class="pn">busways</span>
<span class="pc">:</span>
<span class="pa"> bool = False</span>
</div>
<div class="param">
<span class="pn">green_footways</span>
<span class="pc">:</span>
<span class="pa"> bool = False</span>
</div>
<div class="param">
<span class="pn">green_service_roads</span>
<span class="pc">:</span>
<span class="pa"> bool = False</span>
</div>
<div class="param">
<span class="pn">timeout</span>
<span class="pc">:</span>
Expand Down Expand Up @@ -435,6 +460,16 @@ builds a graph automatically.
Whether to automatically simplify the OSM graph.</div>
</div>

<div class="param-set">
<div class="def">
<div class="name">final_clean_distances</div>
<div class="type">tuple[int]</div>
</div>
<div class="desc">

A tuple of distances to use for the final cleaning step. These will be applied incrementally. (6, 12) by default.</div>
</div>

<div class="param-set">
<div class="def">
<div class="name">remove_disconnected</div>
Expand All @@ -445,6 +480,46 @@ builds a graph automatically.
Remove disconnected components containing fewer nodes than specified. 100 nodes by default.</div>
</div>

<div class="param-set">
<div class="def">
<div class="name">cycleways</div>
<div class="type">bool</div>
</div>
<div class="desc">

Whether to include cycleways. True by default.</div>
</div>

<div class="param-set">
<div class="def">
<div class="name">busways</div>
<div class="type">bool</div>
</div>
<div class="desc">

Whether to include busways. False by default.</div>
</div>

<div class="param-set">
<div class="def">
<div class="name">green_footways</div>
<div class="type">bool</div>
</div>
<div class="desc">

Whether to include footways contained by green areas. When True, footways contained by green areas are kept but are labelled as `footway_green` and can be removed manually if required. False by default.</div>
</div>

<div class="param-set">
<div class="def">
<div class="name">green_service_roads</div>
<div class="type">bool</div>
</div>
<div class="desc">

Whether to include service roads contained by green areas. When True, service roads contained by green areas are kept but are labelled as `service_green` and can be removed manually if required. False by default.</div>
</div>

<div class="param-set">
<div class="def">
<div class="name">timeout</div>
Expand Down
2 changes: 2 additions & 0 deletions docs/src/pages/tools/util.md
Original file line number Diff line number Diff line change
Expand Up @@ -664,6 +664,7 @@ layout: ../../layouts/PageLayout.astro
<span class="pt">)-&gt;[</span>
<span class="pr">STRtree</span>
<span class="pr">list[dict[str</span>
<span class="pr">Any]]</span>
<span class="pt">]</span>
</div>
</div>
Expand All @@ -688,6 +689,7 @@ layout: ../../layouts/PageLayout.astro
<span class="pt">)-&gt;[</span>
<span class="pr">STRtree</span>
<span class="pr">list[dict[str</span>
<span class="pr">Any]]</span>
<span class="pt">]</span>
</div>
</div>
Expand Down
3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "cityseer"
version = '4.16.2'
version = '4.16.12'
description = "Computational tools for network-based pedestrian-scale urban analysis"
readme = "README.md"
requires-python = ">=3.10, <3.14"
Expand Down Expand Up @@ -47,7 +47,6 @@ dependencies = [
"numpy>=1.23.3",
"geopandas>=0.12.2",
"rasterio>=1.3.9",
"pyarrow>=16.0.0",
"fiona>=1.9.6",
"osmnx>=2.0.0",
]
Expand Down
Loading

0 comments on commit b68f1f4

Please sign in to comment.