24.1.23. Vector coverage
24.1.23.1. Clean coverage
Added in 4.4
Operates on a coverage (represented as a list of polygon features) to fix cases where the geometry does not in fact exactly match, repairing small overlaps and gaps to restore a valid topological coverage.
The algorithm uses a combination of snapping and gap/overlap merging. Snapping to nearby vertices and line segments improves noding robustness and eliminates small errors. If the snapping distance is not specified, an automatic distance based on the data extent is used. A distance of 0 disables snapping.
Gaps and holes that are narrower than the a speified width are merged with an adjacent polygon. Gaps which are not fully enclosed (“inlets”) are not removed. When repairing overlaps and gaps, a strategy can be used to determine which adjacent polygon the problematic area is merged into (e.g., merging with the polygon that shares the longest border, or the one with the maximum/minimum area). Polygons that have collapsed during cleaning will be returned as empty polygons.
Fig. 24.89 Cleaning gaps and overlays within a coverage
Allows features in-place modification
of polygon features
Parameters
Label |
Name |
Type |
Description |
|---|---|---|---|
Input layer |
|
[vector: polygon] |
Input polygon vector layer |
Maximum gap width |
|
[numeric: double] Default: 0.0 |
Gaps which are narrower than this distance are merged with an adjacent polygon. Polygon width is determined as twice the radius of the maximum inscribed circle of the gap polygon. Empty holes in input polygons are treated as gaps, and may be filled in. Gaps which are not fully enclosed (‘inlets’) are not removed. |
Snapping distance Optional |
|
[numeric: double] |
Snapping to nearby vertices and line segment snapping is used to improve noding robustness and eliminate small errors in an efficient way. By default the snapping distance is not set, which means that the clean operation uses a very small snapping distance based on the extent of the input data. A distance of zero prevents snapping from being used. |
Overlap merge strategy |
|
[enumeration] Default: 0 |
Determines the strategy used to merge gaps with adjacent polygons. One of:
|
Cleaned |
|
[vector: polygon] Default: |
Specify the output vector layer with cleaned coverage. One of:
The file encoding can also be changed here. |
Outputs
Label |
Name |
Type |
Description |
|---|---|---|---|
Cleaned |
|
[vector: polygon] |
The output polygon vector layer with cleaned gaps and overlays. |
Python code
Algorithm ID: native:coverageclean
import processing
processing.run("algorithm_id", {parameter_dictionary})
The algorithm id is displayed when you hover over the algorithm in the Processing Toolbox. The parameter dictionary provides the parameter NAMEs and values. See Using processing algorithms from the console for details on how to run processing algorithms from the Python console.
24.1.23.2. Dissolve coverage
Added in 3.36
Operates on a coverage (represented as a set of polygon features with exactly matching edge geometry) to dissolve (union) the geometries. It provides a heavily optimized approach for unioning these features compared with the standard Dissolve tools.
See also
Parameters
Label |
Name |
Type |
Description |
|---|---|---|---|
Input layer |
|
[vector: polygon] |
Input polygon vector layer |
Dissolved |
|
[vector: polygon] Default: |
Specify the output vector layer. One of:
The file encoding can also be changed here. |
Outputs
Label |
Name |
Type |
Description |
|---|---|---|---|
Dissolved |
|
[vector: polygon] |
The output polygon vector layer with dissolved geometries. |
Python code
Algorithm ID: native:coverageunion
import processing
processing.run("algorithm_id", {parameter_dictionary})
The algorithm id is displayed when you hover over the algorithm in the Processing Toolbox. The parameter dictionary provides the parameter NAMEs and values. See Using processing algorithms from the console for details on how to run processing algorithms from the Python console.
24.1.23.3. Simplify coverage
Added in 3.36
Operates on a coverage (represented as a set of polygon features with exactly matching edge geometry) to apply a Visvalingam–Whyatt simplification to the edges, reducing complexity in proportion with the provided tolerance, while retaining a valid coverage (i.e. no edges will cross or touch after the simplification). Geometries will never be removed, but they may be simplified down to just a triangle. Also, some geometries (such as polygons which have too few non-repeated points) will be returned unchanged.
If the input dataset is not a valid coverage due to overlaps, it will still be simplified, but invalid topology such as crossing edges will still be invalid.
Allows features in-place modification
of polygon features
Attention
Running this algorithm requires QGIS installed with GEOS >= 3.12 (see menu).
Parameters
Label |
Name |
Type |
Description |
|---|---|---|---|
Input layer |
|
[vector: polygon] |
Input polygon vector layer |
Tolerance |
|
[numeric: double] Default: 0.0 |
The maximum distance (in unit of choice) between two consecutive vertices to get merged. |
Preserve boundary |
|
[boolean] Default: False |
When enabled, the outside edges of the coverage will be preserved without simplification |
Simplified |
|
[vector: polygon] Default: |
Specify the output vector layer. One of:
The file encoding can also be changed here. |
Outputs
Label |
Name |
Type |
Description |
|---|---|---|---|
Simplified |
|
[vector: polygon] |
The output polygon vector layer, with a lower number of vertices. |
Python code
Algorithm ID: native:coveragesimplify
import processing
processing.run("algorithm_id", {parameter_dictionary})
The algorithm id is displayed when you hover over the algorithm in the Processing Toolbox. The parameter dictionary provides the parameter NAMEs and values. See Using processing algorithms from the console for details on how to run processing algorithms from the Python console.
24.1.23.4. Validate coverage
Added in 3.36
Analyzes a coverage (represented as a set of polygon features with exactly matching edge geometry) to find places where the assumption of exactly matching edges is not met. Invalidity includes polygons that overlap or that have gaps smaller than the specified gap width.
Attention
Running this algorithm requires QGIS installed with GEOS >= 3.12 (see menu).
See also
Parameters
Label |
Name |
Type |
Description |
|---|---|---|---|
Input layer |
|
[vector: polygon] |
Input polygon vector layer |
Gap width |
|
[numeric: double] Default: 0.0 |
The maximum width of gap to detect |
Invalid edges |
|
[vector: line] Default: |
Specify the output vector layer. One of:
The file encoding can also be changed here. |
Outputs
Label |
Name |
Type |
Description |
|---|---|---|---|
Invalid edges |
|
[vector: line] |
The output line vector layer showing error edges for each invalid polygon. |
Validity result |
|
[boolean] |
Returns whether the coverage is valid or not. |
Python code
Algorithm ID: native:coveragevalidate
import processing
processing.run("algorithm_id", {parameter_dictionary})
The algorithm id is displayed when you hover over the algorithm in the Processing Toolbox. The parameter dictionary provides the parameter NAMEs and values. See Using processing algorithms from the console for details on how to run processing algorithms from the Python console.