Simplify¶
Description¶
The vec:Simplify
process takes a feature collection and reduces the number of vertices in each feature, simplifying the geometries.
The adopted simplification method is the Douglas-Peucker algorithm. This algorithm uses a distance value as input to determine how the geometries are to be simplified. For a given distance, all vertices in the output simplified geometry will be within this distance of the original geometry. The higher the distance value, the greater the simplification.
The output feature collection may optionally be set to preserve the topology of the features.
Inputs and outputs¶
vec:Simplify
accepts Feature collection inputs and returns Feature collection outputs.
Inputs¶
Name | Description | Type | Usage |
---|---|---|---|
features |
Input feature collection | SimpleFeatureCollection | Required |
distance |
Simplification distance tolerance—Must be non-negative | double | Required |
preserveTopology |
If True, ensures that simplified features are topologically valid | Boolean | Optional |
Outputs¶
Name | Description | Type |
---|---|---|
result |
Simplified feature collection | SimpleFeatureCollection |
Usage notes¶
- The distance value is assumed to be in the same units as the feature collection.
- This process can be applied to feature collections with linear and areal geometries. If the input feature collection contains points, the output feature collection will be identical to the input.
- If the
preserveTopology
parameter is set to True, the process ensures that each simplified geometry has the same dimension and number of components as the input geometry. In particular, if the input is an areal geometry, the result will have the same number of shells and holes (rings) as the input and in the same order. The resulting rings will touch at no more than the number of touching points in the input (they may touch at fewer points). - When simplifying a layer of contiguous polygons, there is no guarantee the polygons will remain contiguous after being simplified. Empty spaces between polygon edges may appear, or the polygons may overlap in places. The following illustration demonstrates this potential side-effect, showing the
usa:states
layer before and after being simplified.
Examples¶
Simplifying street geometries¶
The following example demonstrates the results of simplifying the medford:streets
feature collection, using different distance values.
Input parameters:
features
:medford:streets
distance
:0.002
The process is then repeated using a distance
value of 0.005.
The following illustration shows the different outputs. The original features are represented by the black lines, the first process output with a distance
value of 0.002 is represented by the red lines, and the second process output with a distance
value of 0.005 is represented by the blue lines.