-
Notifications
You must be signed in to change notification settings - Fork 0
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
docstring & typehints in simplify.network_simplify()
, etc.
#107
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -469,39 +469,89 @@ def get_solution(group, roads): | |
|
||
|
||
def simplify_network( | ||
roads, | ||
roads: gpd.GeoDataFrame, | ||
*, | ||
max_segment_length=1, | ||
min_dangle_length=20, | ||
clip_limit: int = 2, | ||
simplification_factor=2, | ||
consolidation_tolerance=10, | ||
artifact_threshold=None, | ||
artifact_threshold_fallback=None, | ||
area_threshold_blocks=1e5, | ||
isoareal_threshold_blocks=0.5, | ||
area_threshold_circles=5e4, | ||
isoareal_threshold_circles_enclosed=0.75, | ||
isoperimetric_threshold_circles_touching=0.9, | ||
eps=1e-4, | ||
exclusion_mask=None, | ||
predicate="intersects", | ||
): | ||
""" | ||
max_segment_length: float | int = 1, | ||
min_dangle_length: float | int = 20, | ||
clip_limit: float | int = 2, | ||
simplification_factor: float | int = 2, | ||
consolidation_tolerance: float | int = 10, | ||
artifact_threshold: None | float | int = None, | ||
artifact_threshold_fallback: None | float | int = None, | ||
area_threshold_blocks: float | int = 1e5, | ||
isoareal_threshold_blocks: float | int = 0.5, | ||
area_threshold_circles: float | int = 5e4, | ||
isoareal_threshold_circles_enclosed: float | int = 0.75, | ||
isoperimetric_threshold_circles_touching: float | int = 0.9, | ||
eps: float = 1e-4, | ||
exclusion_mask: None | gpd.GeoSeries = None, | ||
predicate: str = "intersects", | ||
) -> gpd.GeoDataFrame: | ||
"""Top-level workflow for simplifying networks. The input raw road network data is | ||
first preprocessed (topological corrections & node consolidation) before two | ||
iterations of artifact detection and simplification. For further information on | ||
face artifact detection and extraction see :cite:`fleischmann2023`. | ||
|
||
Parameters | ||
---------- | ||
|
||
clip_limit : int = 2 | ||
roads : geopandas.GeoDataFrame | ||
Raw road network data. | ||
max_segment_length : float | int = 1 | ||
Additional vertices will be added so that all line segments | ||
are no longer than this value. Must be greater than 0. | ||
Used in multiple internal geometric operations. | ||
min_dangle_length : float | int | ||
The threshold for determining if linestrings are dangling slivers to be | ||
removed or not. | ||
clip_limit : float | int = 2 | ||
Following generation of the Voronoi linework in ``geometry.voronoi_skeleton()``, | ||
we clip to fit inside the polygon. To ensure we get a space to make proper | ||
topological connections from the linework to the actual points on the edge of | ||
the polygon, we clip using a polygon with a negative buffer of ``clip_limit`` | ||
or the radius of maximum inscribed circle, whichever is smaller. | ||
simplification_factor : float | int = 2 | ||
The factor by which singles, pairs, and clusters are simplified. | ||
This value is multiplied by ``max_segment_length``. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This can take a bit to understand. In my head it is the vice versa, the |
||
consolidation_tolerance : float | int = 10 | ||
Tolerance passed to node consolidation within the | ||
``geometry.voronoi_skeleton()``. | ||
artifact_threshold : None | float | int = None | ||
First option threshold used to determine face artifacts. | ||
Passed into ``artifacts.get_artifacts()``. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is not clear. When There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also, given |
||
artifact_threshold_fallback : None | float | int = None | ||
Second option threshold used to determine face artifacts. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And this is used as a fallback. So we try to detect artifact threshold from the data and use that one but if that fails, we fall back to the value given here. |
||
Passed into ``artifacts.get_artifacts()``. | ||
area_threshold_blocks : float | int = 1e5 | ||
Areal theshold for block detection. | ||
Passed into ``artifacts.get_artifacts()``. | ||
isoareal_threshold_blocks : float | int = 0.5 | ||
Isoareal theshold for block detection. | ||
See ``esda.shape.isoareal_quotient``. | ||
Passed into ``artifacts.get_artifacts()``. | ||
area_threshold_circles : float | int = 5e4 | ||
Areal theshold for circle detection. | ||
Passed into ``artifacts.get_artifacts()``. | ||
isoareal_threshold_circles_enclosed : float | int = 0.75 | ||
Isoareal theshold for enclosed circle detection. | ||
See ``esda.shape.isoareal_quotient``. | ||
Passed into ``artifacts.get_artifacts()``. | ||
isoperimetric_threshold_circles_touching : float | int = 0.9 | ||
Isoperimetric theshold for enclosed circle touching. | ||
See ``esda.shape.isoperimetric_quotient``. | ||
Passed into ``artifacts.get_artifacts()``. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. All these will eventually, on the public API need more explanation on what they do and why they exist. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll create a ticket dedicated to that. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. xref: #110 |
||
eps : float = 1e-4 | ||
Tolerance epsilon used in multiple internal geometric operations. | ||
exclusion_mask : None | geopandas.GeoSeries = None | ||
Polygons used to determine face artifacts to exclude from returned output. | ||
Passed into ``artifacts.get_artifacts()``. | ||
predicate : str = 'intersects' | ||
The spatial predicate used to exclude face artifacts from returned output. | ||
Passed into ``artifacts.get_artifacts()``. | ||
|
||
Returns | ||
------- | ||
|
||
geopandas.GeoDataFrame | ||
The final, simplified road network line data. | ||
""" | ||
|
||
roads = fix_topology(roads, eps=eps) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will probably need way more but I am happy to craft that documentation at some point.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ya, I intended this a first minimal pass to get the process started. With that in mind, is there any more of an explanation to be added in this iteration?