Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deduplicates non motorised edges #137

Merged
merged 2 commits into from
Nov 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 modified 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 modified 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.
4 changes: 2 additions & 2 deletions docs/src/pages/rustalgos/rustalgos.md
Original file line number Diff line number Diff line change
Expand Up @@ -2807,12 +2807,12 @@ 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>




<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
90 changes: 81 additions & 9 deletions docs/src/pages/tools/graphs.md
Original file line number Diff line number Diff line change
Expand Up @@ -337,9 +337,9 @@ side-effects as a function of varied node intensities when computing network cen
<span class="pn">nx_multigraph</span>
</div>
<div class="param">
<span class="pn">simplify_by_angle</span>
<span class="pn">simplify_by_max_angle</span>
<span class="pc">:</span>
<span class="pa"> int = 100</span>
<span class="pa"> int = 120</span>
</div>
<div class="param">
<span class="pn">min_self_loop_length</span>
Expand Down Expand Up @@ -370,7 +370,7 @@ side-effects as a function of varied node intensities when computing network cen

<div class="param-set">
<div class="def">
<div class="name">simplify_by_angle</div>
<div class="name">simplify_by_max_angle</div>
<div class="type">int</div>
</div>
<div class="desc">
Expand Down Expand Up @@ -415,22 +415,74 @@ side-effects as a function of varied node intensities when computing network cen

<div class="function">

## simplify_line_by_angle
## nx_deduplicate_edges


<div class="content">
<span class="name">simplify_line_by_angle</span><div class="signature multiline">
<span class="name">nx_deduplicate_edges</span><div class="signature multiline">
<span class="pt">(</span>
<div class="param">
<span class="pn">coords</span>
<span class="pn">nx_multigraph</span>
</div>
<div class="param">
<span class="pn">simplify_line_angles</span>
<span class="pn">dissolve_distance</span>
<span class="pc">:</span>
<span class="pa"> int = 12</span>
</div>
<div class="param">
<span class="pn">max_ang_diff</span>
<span class="pc">:</span>
<span class="pa"> int = 20</span>
</div>
<span class="pt">)</span>
</div>
</div>


Deduplicates non-motorised edges where parallel to nearby motorised edges.
### Parameters
<div class="param-set">
<div class="def">
<div class="name">nx_multigraph</div>
<div class="type">MultiGraph</div>
</div>
<div class="desc">

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">dissolve_distance</div>
<div class="type">int</div>
</div>
<div class="desc">

A distance to use when searching for adjacent edges. 12m by default.</div>
</div>

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

Only count a nearby adjacent edge as duplicitous if the angular difference between edges is less than `max_ang_diff`. 20 degrees by default.</div>
</div>

### Returns
<div class="param-set">
<div class="def">
<div class="name"></div>
<div class="type">MultiGraph</div>
</div>
<div class="desc">

A `networkX` graph. The nodes will have a new `weight` parameter indicating the node's contribution given the locally 'dissolved' context.</div>
</div>


</div>


Expand Down Expand Up @@ -491,7 +543,7 @@ side-effects as a function of varied node intensities when computing network cen
<span class="pa"> bool = False</span>
</div>
<div class="param">
<span class="pn">simplify_line_angles</span>
<span class="pn">simplify_by_max_angle</span>
<span class="pc">:</span>
<span class="pa"> int | None = None</span>
</div>
Expand Down Expand Up @@ -608,6 +660,16 @@ side-effects as a function of varied node intensities when computing network cen
Whether to only merge edges with shared OSM `name` or `ref` tags. False by default. Requires graph prepared with via [`io.osm_graph_from_poly`](/io#osm-graph-from-poly).</div>
</div>

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

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

### Returns
<div class="param-set">
<div class="def">
Expand Down Expand Up @@ -731,7 +793,7 @@ side-effects as a function of varied node intensities when computing network cen
<span class="pa"> bool = False</span>
</div>
<div class="param">
<span class="pn">simplify_line_angles</span>
<span class="pn">simplify_by_max_angle</span>
<span class="pc">:</span>
<span class="pa"> int | None = None</span>
</div>
Expand Down Expand Up @@ -850,6 +912,16 @@ side-effects as a function of varied node intensities when computing network cen
Whether to automatically squash new node pairings resulting from splitting a nearby edge. If set to `False` then a line will be added instead. Defaults to `True`.</div>
</div>

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

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

### Returns
<div class="param-set">
<div class="def">
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/tools/io.md
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ builds a graph automatically.
<div class="param">
<span class="pn">final_clean_distances</span>
<span class="pc">:</span>
<span class="pa"> tuple[int, ...] = (6, 12)</span>
<span class="pa"> tuple[int, ...] = (5, 10)</span>
</div>
<div class="param">
<span class="pn">remove_disconnected</span>
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.16.27'
version = '4.17.0'
description = "Computational tools for network-based pedestrian-scale urban analysis"
readme = "README.md"
requires-python = ">=3.10, <3.14"
Expand Down
Loading