neatnet.simplify_network

neatnet.simplify_network#

neatnet.simplify_network(roads, *, max_segment_length=1, min_dangle_length=20, clip_limit=2, simplification_factor=2, consolidation_tolerance=10, artifact_threshold=None, artifact_threshold_fallback=None, 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, exclusion_mask=None, predicate='intersects')[source]#

Top-level workflow for simplifying networks. The input raw road 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].

Parameters:
roadsgeopandas.GeoDataFrame

Raw road network data. This input must be in a projected coordinate reference system and should be in meters. All defaults arguments assume meters.

max_segment_lengthfloat | 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_lengthfloat | int

The threshold for determining if linestrings are dangling slivers to be removed or not.

clip_limitfloat | 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_factorfloat | 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_tolerancefloat | int = 10

Tolerance passed to node consolidation when generating Voronoi skeletons.

artifact_thresholdNone | float | int = None

When artifact_threshold is passed, the computed value from momepy.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_fallbackNone | float | int = None

If artifact threshold detection fails, this value is used as a fallback.

area_threshold_blocksfloat | 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 below area_threshold_blocks, and is of elongated shape (see also isoareal_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_blocksfloat | 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 below isoareal_threshold_blocks (see esda.shape.isoareal_quotient), i.e., if it has an elongated shape; and it has a sufficiently small area (see also area_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_circlesfloat | 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 below area_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 (see esda.shape.isoperimetric_quotient) above isoperimetric_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 above isoareal_threshold_circles_enclosed, i.e., if its shape is close to circular; then it will be classified as an artifact.

isoareal_threshold_circles_enclosedfloat | 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 also area_threshold_circles), and the polygon is fully enclosed by polygons already classified as artifacts, and its isoareal quotient (see esda.shape.isoareal_quotient) is above the value passed to isoareal_threshold_circles_enclosed, i.e., if its shape is close to circular; then it will be classified as an artifact.

isoperimetric_threshold_circles_touchingfloat | 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 also area_threshold_circles), and the polygon is touched by at least one polygon already classified as artifact, and its isoperimetric quotient (see esda.shape.isoperimetric_quotient) is above the value passed to isoperimetric_threshold_circles_touching, i.e., if its shape is close to circular; then it will be classified as an artifact.

epsfloat = 1e-4

Tolerance epsilon used in multiple internal geometric operations.

exclusion_maskNone | geopandas.GeoSeries = None

Polygons used to determine face artifacts to exclude from returned output.

predicatestr = ‘intersects’

The spatial predicate used to exclude face artifacts from returned output.

Returns:
geopandas.GeoDataFrame

The final, simplified road 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.