Skip to content

Commit

Permalink
ENH: improved node consolidation functions (#377)
Browse files Browse the repository at this point in the history
* including node_consolidation function

* adding imports of nx split and deepcopy

* importing nx_to_gdf

* adding data for a street network

* testing consolidate_intersections

* formatting graph dataset loading

* formatting the tests file

* adding consolidate_intersections to functions to test list

* updating networkx to 2.5 in minimal env

* fixing docstrings and adding test for warning section

* cleaning method user input

* docstring of extension

added a note about overlapping geometry to extension docstring

Co-authored-by: Martin Fleischmann <martin@martinfleischmann.net>

* fixed docstring

Co-authored-by: Martin Fleischmann <martin@martinfleischmann.net>

* fixed docstring

rebuild_edges_method

Co-authored-by: Martin Fleischmann <martin@martinfleischmann.net>

* grammar

Co-authored-by: Martin Fleischmann <martin@martinfleischmann.net>

* added default tolerance

Co-authored-by: Martin Fleischmann <martin@martinfleischmann.net>

* replacing column with attribute naming

* adding approach to simplified_graph object

* input can be non-Multi graph type

* throw exception when simplification method unrecofnized

* removing directed paramater, always infer directionality

* set_geometry in the edge dataframe

* adding notebook to user_guide

* lint issues

* fix

* try fixing the kernel issue

* adapt title

* api reference

* conditional import of osmnx in tests

* Apply suggestions from code review

Co-authored-by: James Gaboardi <jgaboardi@gmail.com>

---------

Co-authored-by: Martin Fleischmann <martin@martinfleischmann.net>
Co-authored-by: James Gaboardi <jgaboardi@gmail.com>
  • Loading branch information
3 people authored Jan 23, 2024
1 parent 24672bf commit 97c6e03
Show file tree
Hide file tree
Showing 7 changed files with 2,125 additions and 4 deletions.
1 change: 1 addition & 0 deletions docs/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ preprocessing
:toctree: generated/

close_gaps
consolidate_intersections
CheckTessellationInput
extend_lines
FaceArtifacts
Expand Down
309 changes: 309 additions & 0 deletions docs/user_guide/preprocessing/consolidate_intersections.ipynb

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions docs/user_guide/preprocessing/preprocessing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ This section covers:

simple_preprocessing
roundabout_simplification
consolidate_intersections
8 changes: 5 additions & 3 deletions momepy/datasets/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,22 @@
__all__ = ["available", "get_path"]

_module_path = Path(__file__).resolve().parent
available = ["bubenec", "tests"]
available = ["bubenec", "tests", "nyc_graph"]


def get_path(dataset):
def get_path(dataset, extension="gpkg"):
"""
Get the path to the data file.
Parameters
----------
dataset : str
The name of the dataset. See ``momepy.datasets.available`` for
all options.
extension : str
The extension of the data file
"""
if dataset in available:
return str(_module_path / (dataset + ".gpkg"))
return str(_module_path / (f"{dataset}.{extension}"))
msg = (
f"The dataset {dataset!r} is not available. "
f"Available datasets are {', '.join(available)}"
Expand Down
Loading

0 comments on commit 97c6e03

Please sign in to comment.