neatnet.neatify#
- neatnet.neatify(streets, *, exclusion_mask=None, predicate='intersects', max_segment_length=1, min_dangle_length=20, clip_limit=2, simplification_factor=2, consolidation_tolerance=10, artifact_threshold=None, artifact_threshold_fallback=7, area_threshold_blocks=100000.0, isoareal_threshold_blocks=0.5, area_threshold_circles=50000.0, isoareal_threshold_circles_enclosed=0.75, isoperimetric_threshold_circles_touching=0.9, eps=0.0001, n_loops=2)[source]#
Top-level workflow for simplifying street networks. The input raw street network data, which must be in a projected coordinate reference system and is expected to be in meters, is first preprocessed (topological corrections & node consolidation) before two iterations of artifact detection and simplification.
Each iteration of the simplification procedure which includes (1.) the removal of false nodes; (2.) face artifact classification; and (3.) the line-based simplification of face artifacts in the order of single artifacts, pairs of artifacts, clusters of artifacts.
For further information on face artifact detection and extraction see [FV24].
This algorithm is designed for use with only “street” network geometries as input. While passing in other types of pathing (e.g., sidewalks, canals) will likely yield valid geometric results, that behavior is untested.
- Parameters:
- streets
geopandas.GeoDataFrame
Raw street network data. This input must be in a projected coordinate reference system and should be in meters. All defaults arguments assume meters. The internal algorithm is designed for use with street network geometries, not other types of pathing (e.g., sidewalks, canals), which should be filtered out.
- exclusion_mask
None
|geopandas.GeoSeries
=None
Geometries used to determine face artifacts to exclude from returned output.
- predicate
str
= ‘intersects’ The spatial predicate used to exclude face artifacts from returned output.
- 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, 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. The
max_segment_length
is multiplied by this factor to get the simplification epsilon.- consolidation_tolerance
float
|int
= 10 Tolerance passed to node consolidation when generating Voronoi skeletons.
- artifact_threshold
None
|float
|int
=None
When
artifact_threshold
is passed, the computed value frommomepy.FaceArtifacts.threshold
is not used in favor of the given value. This is useful for small networks where artifact detection may fail or become unreliable.- artifact_threshold_fallback
float
|int
= 7 If artifact threshold detection fails, this value is used as a fallback.
- area_threshold_blocks
float
|int
= 1e5 This is the first threshold for detecting block-like artifacts whose Face Artifact Index (see [FV24]) is above the value passed in
artifact_threshold
. If a polygon has an area belowarea_threshold_blocks
, and is of elongated shape (see alsoisoareal_threshold_blocks
), and touches at least one polygon that has already been classified as artifact, then it will be classified as an artifact.- isoareal_threshold_blocks
float
|int
= 0.5 This is the second threshold for detecting block-like artifacts whose Face Artifact Index (see [FV24]) is above the value passed in
artifact_threshold
. If a polygon has an isoareal quotient belowisoareal_threshold_blocks
(seeesda.shape.isoareal_quotient
), i.e., if it has an elongated shape; and it has a sufficiently small area (see alsoarea_threshold_blocks
), and if it touches at least one polygon that has already been detected as an artifact, then it will be classified as an artifact.- area_threshold_circles
float
|int
= 5e4 This is the first threshold for detecting circle-like artifacts whose Face Artifact Index (see [FV24]) is above the value passed in
artifact_threshold
. If a polygon has an area belowarea_threshold_circles
, and one of the following 2 cases is given: (a) the polygon is touched, but not enclosed by polygons already classified as artifacts, and with an isoperimetric quotient (seeesda.shape.isoperimetric_quotient
) aboveisoperimetric_threshold_circles_touching
, i.e., if its shape is close to circular; or (b) the polygon is fully enclosed by polygons already classified as artifacts, and with an isoareal quotient aboveisoareal_threshold_circles_enclosed
, i.e., if its shape is close to circular; then it will be classified as an artifact.- isoareal_threshold_circles_enclosed
float
|int
= 0.75 This is the second threshold for detecting circle-like artifacts whose Face Artifact Index (see [FV24]) is above the value passed in
artifact_threshold
. If a polygon has a sufficiently small area (see alsoarea_threshold_circles
), and the polygon is fully enclosed by polygons already classified as artifacts, and its isoareal quotient (seeesda.shape.isoareal_quotient
) is above the value passed toisoareal_threshold_circles_enclosed
, i.e., if its shape is close to circular; then it will be classified as an artifact.- isoperimetric_threshold_circles_touching
float
|int
= 0.9 This is the third threshold for detecting circle-like artifacts whose Face Artifact Index (see [FV24]) is above the value passed in
artifact_threshold
. If a polygon has a sufficiently small area (see alsoarea_threshold_circles
), and the polygon is touched by at least one polygon already classified as artifact, and its isoperimetric quotient (seeesda.shape.isoperimetric_quotient
) is above the value passed toisoperimetric_threshold_circles_touching
, i.e., if its shape is close to circular; then it will be classified as an artifact.- eps
float
= 1e-4 Tolerance epsilon used in multiple internal geometric operations.
- n_loops
int
= 2 Number of loops through the simplification pipeline. It is recommended to stick to the default value and increase it only very conservatively.
- streets
- Returns:
geopandas.GeoDataFrame
The final, simplified street network line data.
Notes
As is noted above, the input network data must be in a projected coordinate reference system and is expected to be in meters. However, it may be possible to work with network data projected in feet if all default arguments are adjusted.