LineSimplification
The LineSimplification
operator allows simplifying FeatureCollection
s of (multi-)lines or (multi-)polygons by removing vertices.
Users can select a simplification algorithm and specify an epsilon
for parametrization.
Alternatively, they can omit the epsilon
, which results in the epsilon
being automatically determined by the query's spatial resolution.
For instance, you can remove the vertices of a large country polygon for drawing it on a small map. This results in a simpler polygon that is easier to draw and reduces the amount of data that needs to be transferred.
Parameters
Parameter | Type | Description | Example Value |
---|---|---|---|
epsilon | (optional) number | Specify the parametrization of the simplification algorith, e.g. the distance threshold for two nodes in Douglas-Peucker. Must be > 0. | 1.0 |
algorithm | douglasPeucker or visvalingam | Select a simplification algorith for being used, e.g. Douglas-Peucker or Visvalingam | "douglasPeucker" |
Inputs
The LineSimplification
operator expects exactly one vector input.
Parameter | Type |
---|---|
vector | SingleVectorSource |
Errors
- If
epsilon
is set but <= 0, an error is thrown. - If the input is not
MultiPolygon
orMultiLineString
, an error is thrown.
Example JSON
{
"type": "LineSimplification",
"params": {
"algorithm": "douglasPeucker",
"epsilon": 1.0
},
"sources": {
"vector": {
"type": "OgrSource",
"params": {
"data": "ne_10m_admin_0_countries"
}
}
}
}
{
"type": "LineSimplification",
"params": {
"algorithm": "visvalingam"
},
"sources": {
"vector": {
"type": "OgrSource",
"params": {
"data": "ne_10m_admin_0_countries"
}
}
}
}