Skip to content

Commit

Permalink
Merge pull request #90 from benchmark-urbanism/dev
Browse files Browse the repository at this point in the history
Updates graph cleaning
  • Loading branch information
songololo authored Nov 11, 2023
2 parents f1b3e2d + 0837230 commit fb61e61
Showing 22 changed files with 8,502 additions and 292 deletions.
514 changes: 514 additions & 0 deletions demos/continuity/continuity_os_open.ipynb

Large diffs are not rendered by default.

496 changes: 496 additions & 0 deletions demos/continuity/continuity_osm.ipynb

Large diffs are not rendered by default.

1,190 changes: 1,190 additions & 0 deletions demos/getting_started.ipynb

Large diffs are not rendered by default.

536 changes: 536 additions & 0 deletions demos/graph_cleaning.ipynb

Large diffs are not rendered by default.

584 changes: 584 additions & 0 deletions demos/graph_corrections.ipynb

Large diffs are not rendered by default.

464 changes: 464 additions & 0 deletions demos/london_amenities.ipynb

Large diffs are not rendered by default.

420 changes: 420 additions & 0 deletions demos/london_centralities.ipynb

Large diffs are not rendered by default.

937 changes: 937 additions & 0 deletions demos/momepy_to_cityseer.ipynb

Large diffs are not rendered by default.

369 changes: 369 additions & 0 deletions demos/osm_to_cityseer.ipynb

Large diffs are not rendered by default.

1,917 changes: 1,917 additions & 0 deletions demos/vae/vae.ipynb

Large diffs are not rendered by default.

882 changes: 882 additions & 0 deletions demos/vae/vae_selection.ipynb

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/src/pages/rustalgos/rustalgos.md
Original file line number Diff line number Diff line change
@@ -2726,7 +2726,7 @@ datapoints are not located with high spatial precision.



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



@@ -2736,7 +2736,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_ys</span><span class="annotation">: list[float]</span>



41 changes: 13 additions & 28 deletions docs/src/pages/tools/graphs.md
Original file line number Diff line number Diff line change
@@ -131,7 +131,7 @@ side-effects as a function of varied node intensities when computing network cen
<div class="param">
<span class="pn">despine</span>
<span class="pc">:</span>
<span class="pa"> float | None = None</span>
<span class="pa"> int = 15</span>
</div>
<div class="param">
<span class="pn">remove_disconnected</span>
@@ -163,11 +163,11 @@ side-effects as a function of varied node intensities when computing network cen
<div class="param-set">
<div class="def">
<div class="name">despine</div>
<div class="type">bool</div>
<div class="type">int</div>
</div>
<div class="desc">

The maximum cutoff distance for removal of dead-ends. Use `None` or `0` where no despining should occur. Defaults to None.</div>
The maximum cutoff distance for removal of dead-ends. Use `0` where no despining should occur.</div>
</div>

<div class="param-set">
@@ -382,7 +382,7 @@ side-effects as a function of varied node intensities when computing network cen
<div class="param">
<span class="pn">buffer_dist</span>
<span class="pc">:</span>
<span class="pa"> float = 5</span>
<span class="pa"> float = 12</span>
</div>
<div class="param">
<span class="pn">neighbour_policy</span>
@@ -395,15 +395,10 @@ 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">centroid_by_straightness</span>
<span class="pn">centroid_by_itx</span>
<span class="pc">:</span>
<span class="pa"> bool = True</span>
</div>
<div class="param">
<span class="pn">centroid_by_min_len_factor</span>
<span class="pc">:</span>
<span class="pa"> float | None = None</span>
</div>
<div class="param">
<span class="pn">merge_edges_by_midline</span>
<span class="pc">:</span>
@@ -412,7 +407,7 @@ side-effects as a function of varied node intensities when computing network cen
<div class="param">
<span class="pn">contains_buffer_dist</span>
<span class="pc">:</span>
<span class="pa"> int = 20</span>
<span class="pa"> int = 40</span>
</div>
<span class="pt">)</span>
</div>
@@ -467,27 +462,17 @@ side-effects as a function of varied node intensities when computing network cen
</div>
<div class="desc">

Whether the algorithm will recursively explore neighbours of neighbours if those neighbours are within the buffer distance from the prior node. Defaults to True.</div>
Whether the algorithm will recursively explore neighbours of neighbours if those neighbours are within the buffer distance from the prior node. Defaults to False.</div>
</div>

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

Whether to use an intersection straightness heuristic to select new centroids. True by default.</div>
</div>

<div class="param-set">
<div class="def">
<div class="name">centroid_by_min_len_factor</div>
<div class="type">float</div>
</div>
<div class="desc">

The minimum aggregate adjacent edge lengths an existing node should have to be considered when calculating the centroid for the new node cluster. Expressed as a factor of the node with the greatest aggregate adjacent edge lengths. Defaults to None.</div>
Whether to favour intersections when selecting the combined centroid of merged nodes. Intersections with two straight through-routes will be favoured if found, otherwise intersections with one straight through-route are used where available. True by default.</div>
</div>

<div class="param-set">
@@ -507,14 +492,14 @@ side-effects as a function of varied node intensities when computing network cen
</div>
<div class="desc">

The buffer distance to consider when checking if parallel edges are sufficiently similar to be merged.</div>
The buffer distance to consider when checking if parallel edges sharing the same start and end nodes are sufficiently similar to be merged. This is run after node consolidation has completed.</div>
</div>

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

@@ -546,7 +531,7 @@ side-effects as a function of varied node intensities when computing network cen
<div class="param">
<span class="pn">buffer_dist</span>
<span class="pc">:</span>
<span class="pa"> float = 10</span>
<span class="pa"> float = 12</span>
</div>
<div class="param">
<span class="pn">merge_edges_by_midline</span>
@@ -556,7 +541,7 @@ side-effects as a function of varied node intensities when computing network cen
<div class="param">
<span class="pn">contains_buffer_dist</span>
<span class="pc">:</span>
<span class="pa"> float = 20</span>
<span class="pa"> float = 40</span>
</div>
<span class="pt">)</span>
</div>
50 changes: 0 additions & 50 deletions docs/src/pages/tools/io.md
Original file line number Diff line number Diff line change
@@ -363,11 +363,6 @@ builds a graph automatically.
<span class="pc">:</span>
<span class="pa"> int | None = None</span>
</div>
<div class="param">
<span class="pn">buffer_dist</span>
<span class="pc">:</span>
<span class="pa"> int = 15</span>
</div>
<div class="param">
<span class="pn">custom_request</span>
<span class="pc">:</span>
@@ -378,21 +373,6 @@ builds a graph automatically.
<span class="pc">:</span>
<span class="pa"> bool = True</span>
</div>
<div class="param">
<span class="pn">remove_parallel</span>
<span class="pc">:</span>
<span class="pa"> bool = True</span>
</div>
<div class="param">
<span class="pn">iron_edges</span>
<span class="pc">:</span>
<span class="pa"> bool = True</span>
</div>
<div class="param">
<span class="pn">remove_disconnected</span>
<span class="pc">:</span>
<span class="pa"> bool = True</span>
</div>
<div class="param">
<span class="pn">timeout</span>
<span class="pc">:</span>
@@ -472,36 +452,6 @@ builds a graph automatically.
Whether to automatically simplify the OSM graph. Set to False for manual cleaning.</div>
</div>

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

Ignored if simplify is False. Whether to remove parallel roadway segments.</div>
</div>

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

Ignored if simplify is False. Whether to straighten the ends of street segments. This can help to reduce the number of artefacts from segment kinks from merging `LineStrings`.</div>
</div>

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

Ignored if simplify is False. Whether to remove disconnected components from the network.</div>
</div>

<div class="param-set">
<div class="def">
<div class="name">timeout</div>
23 changes: 9 additions & 14 deletions docs/src/pages/tools/util.md
Original file line number Diff line number Diff line change
@@ -119,30 +119,25 @@ layout: ../../layouts/PageLayout.astro

<div class="function">

## substring
## measure_max_angle


<div class="content">
<span class="name">substring</span><div class="signature multiline">
<span class="name">measure_max_angle</span><div class="signature">
<span class="pt">(</span>
<div class="param">
<span class="pn">geom</span>
</div>
<div class="param">
<span class="pn">start_dist</span>
</div>
<div class="param">
<span class="pn">end_dist</span>
</div>
<div class="param">
<span class="pn">normalized=False</span>
<span class="pn">linestring_coords</span>
<span class="pc">:</span>
<span class="pa"> list[typing.Union[tuple[float, float], tuple[float, float, float]]]</span>
</div>
<span class="pt">)</span>
<span class="pt">)-&gt;[</span>
<span class="pr">float</span>
<span class="pt">]</span>
</div>
</div>


Temporary copy of shapely substring method until issue #1699 is fixed (re: z coords).
Measures the maximum angle along a LineString geom's coords.

</div>

7 changes: 4 additions & 3 deletions pdm.lock

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

4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "cityseer"
version = '4.2.6'
version = '4.3.0'
description = "Computational tools for network-based pedestrian-scale urban analysis"
readme = "README.md"
requires-python = ">=3.10, <3.12"
@@ -44,7 +44,7 @@ dependencies = [
"scikit-learn>=1.0.2",
"tqdm>=4.63.1",
"utm>=0.7.0",
"shapely>=2.0.1",
"shapely>=2.0.2",
"numpy>=1.23.3",
"geopandas>=0.12.2",
]
Loading

0 comments on commit fb61e61

Please sign in to comment.