Skip to content

Commit

Permalink
Merge pull request #89 from benchmark-urbanism/dev
Browse files Browse the repository at this point in the history
adds sidewalks to OSM default query
  • Loading branch information
songololo authored Nov 10, 2023
2 parents 1edd1d5 + 28fd70f commit 698a48e
Show file tree
Hide file tree
Showing 37 changed files with 930 additions and 810 deletions.
353 changes: 174 additions & 179 deletions demos/getting_started.ipynb

Large diffs are not rendered by default.

739 changes: 346 additions & 393 deletions demos/momepy_to_cityseer.ipynb

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/plots/plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ def simple_plot(_G, _path, plot_geoms=True):
G = graphs.nx_decompose(G, 50)
nodes_gdf, edges_gdf, network_structure = io.network_structure_from_nx(G, crs=3395)
networks.node_centrality_shortest(network_structure=network_structure, nodes_gdf=nodes_gdf, distances=[800])
G_after = io.nx_from_geopandas(nodes_gdf, edges_gdf)
G_after = io.nx_from_cityseer_geopandas(nodes_gdf, edges_gdf)
# let's extract and normalise the values
vals = []
for node, data in G_after.nodes(data=True):
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 modified docs/public/images/graph_cleaning_1.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_cleaning_1b.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_cleaning_2.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_cleaning_3.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_cleaning_4.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_cleaning_5.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_cleaning_6.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_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.
6 changes: 6 additions & 0 deletions docs/src/pages/examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ Examples showing how to import OSM data as discussed in [OSM and NetworkX](/guid

<a href="https://github.com/benchmark-urbanism/cityseer-api/blob/master/demos/osm_to_cityseer.ipynb" target="_blank">Github: osm_to_cityseer.ipynb</a>

## Importing GeoPandas LineString data

Example showing how to import `GeoPandas` LineString data. This approach is demonstrated for ingesting a `momepy` network which can then be used for centrality and landuse accessibility analysis.

<a href="https://github.com/benchmark-urbanism/cityseer-api/blob/master/demos/momepy_to_cityseer.ipynb" target="_blank">Github: momepy_to_cityseer.ipynb</a>

## Centralities for London

Computing network centralities for London with OS Open data.
Expand Down
8 changes: 4 additions & 4 deletions docs/src/pages/guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,12 @@ The following points may be helpful when using `OSMnx` and `cityseer` together:

See the [Importing OSM data](/examples#importing-osm-data) notebook for examples.

## GeoPandas

[`GeoPandas`](https://geopandas.org/) adds support for spatial features and related operations to `Pandas` dataframes. However, dataframes can be slow for purposes of iteratively adding and removing rows, for which reason it is preferable to use `networkX` graphs for the graph cleaning and preparation stage of analysis. After graph preparation steps, `cityseer` uses `GeoDataFrame` structures for data state. The [`tools.io.nx_from_generic_geopandas`](/tools/io#nx-from-generic-geopandas) method can be used to convert `GeoPandas` LineString DataFrames --- such as those used by [`momepy`](http://docs.momepy.org) --- to and from `cityseer` compatible graphs.

## Optimised packages

Computational methods for network-based analysis rely extensively on shortest-path algorithms: these present substantial computational complexity due to nested-loops. For this reason, methods implemented in pure `Python`, i.e. [`NetworkX`](https://networkx.github.io/) or packages that depend on it for algorithmic analysis, can be prohibitively slow. Speed improvements can be found by running intensive algorithms against packages implemented in lower-level languages such as [`Graph-Tool`](https://graph-tool.skewed.de) or [`igraph`](https://igraph.org/python#docs), which wrap underlying optimised code libraries implemented in more performant languages such as `C++`. However, off-the-shelf network analysis packages are not ideal for application to urbanism; they do not ordinarily cater for localised distance thresholds, specialised centrality methods, shortest vs simplest-path heuristics, or calculation of land-use accessibilities and mixed-uses.

`cityseer` evolved as a WIP package over the span of years, initially used for experimentation and comparative tests of centrality methods and landuse methods during a PhD. Initially, computationally intensive algorithms were wrapped in [`numba`](https://numba.pydata.org/) for the sake of performant JIT compilation and parallelisation. The use of `numba` made it feasible to scale these methods to large and, optionally, decomposed networks with significant numbers of nodes. More recent versions of `cityseer` have moved underlying algorithms from `numba` to `rust`, which offers yet better performance, doesn't require a compilation step when running a function for the first time, and affords the use of more elegant design patterns.

## _GeoPandas_

[`GeoPandas`](https://geopandas.org/) adds support for spatial features and related operations to `Pandas` dataframes. However, dataframes can be slow for purposes of iteratively adding and removing rows, for which reason it is preferable to use `networkX` graphs for the graph cleaning and preparation stage of analysis. After graph preparation steps, `cityseer` uses `GeoDataFrame` structures for data state. It is relatively straight-forward to convert `GeoPandas` network and data representations --- such as those used by [`momepy`](http://docs.momepy.org) --- to and from `cityseer` compatible graphs or data structures. Efforts are ongoing to automate these forms of workflows. Stay tuned!
4 changes: 2 additions & 2 deletions docs/src/pages/intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -267,10 +267,10 @@ print(nodes_gdf["cc_metric_mean_wt_800"])

The landuse metrics and statistical aggregations are computed over the street network relative to the network, with results written to each node. The mixed-use, accessibility, and statistical aggregations can therefore be compared directly to centrality computations from the same locations, and can be correlated or otherwise compared.

Data derived from metrics can be converted back into a `NetworkX` graph using the [nx_from_geopandas](/metrics/networks#nx-from-network-geopandas) method.
Data derived from metrics can be converted back into a `NetworkX` graph using the [nx_from_cityseer_geopandas](/tools/io#nx-from-cityseer-geopandas) method.

```python
nx_multigraph_round_trip = io.nx_from_geopandas(
nx_multigraph_round_trip = io.nx_from_cityseer_geopandas(
nodes_gdf,
edges_gdf,
)
Expand Down
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_xys</span><span class="annotation">: list[tuple[float, float]]</span>
<span class="name">node_ys</span><span class="annotation">: list[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_xs</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_ys</span><span class="annotation">: list[float]</span>
<span class="name">node_lives</span><span class="annotation">: list[bool]</span>



Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/tools/graphs.md
Original file line number Diff line number Diff line change
Expand Up @@ -788,7 +788,7 @@ plot.plot_nx_primal_or_dual(G_simple,
</div>


Generates graph node weightings based on the ratio of directly adjacent edges to total nearby edges. This is used to control for unintended amplification of centrality measures where redundant network representations (e.g. complicated intersections or duplicitious segments, i.e. street, sidewalk, cycleway, busway) tend to inflate centrality scores. This method is intended for 'messier' network representations (e.g. OSM).
Generates graph node weightings based on the ratio of directly adjacent edges to total nearby edges. This is used to control for unintended amplification of centrality measures where redundant network representations (e.g. duplicitious segments such as adjacent street, sidewalk, cycleway, busway) tend to inflate centrality scores. This method is intended for 'messier' network representations (e.g. OSM).
### Parameters
<div class="param-set">
<div class="def">
Expand Down
Loading

0 comments on commit 698a48e

Please sign in to comment.