GeoProcessor / Command / SimplifyGeoLayerGeometry
Overview
The SimplifyGeoLayerGeometry
command decreases the number of vertices within the geometries
for each feature of a GeoLayer.
This command is useful when the file size of a GeoLayer is too large.
- This command is designed to simplify GeoLayers with
LINE
orPOLYGON
geometry by removing unnecessary vertices. GeoLayers withPOINT
geometry cannot be simplified with this command. - The file size of the simplified GeoLayer will be smaller than the input GeoLayer.
- The spatial accuracy of the simplified GeoLayer be less precise than the input GeoLayer.
Command Editor
The following dialog is used to edit the command and illustrates the command syntax.
SimplifyGeoLayerGeometry
Command Editor (see full-size image)
Command Syntax
The command syntax is as follows:
SimplifyGeoLayerGeometry(Parameter="Value",...)
Command Parameters
Parameter | Description | Default |
---|---|---|
GeoLayerID required |
The ID of the GeoLayer to be simplified. | None - must be specified. |
Tolerance required |
The ε variable in the Douglas–Peucker algorithm . Units are the same as the distance units of the GeoLayer's coordinate reference system. For example, WGS84 EPSG:4326 uses decimal degrees and NAD83 Zone13N EPSG:26913 uses meters. Units for common coordinate reference systems can be looked up at the epsg.io site.Refer to the Douglas–Peucker Algorithm section for more information. |
None - must be specified. |
SimplifyMethod |
The simplification method used to simplify the GeoLayer:
|
DouglasPeucker |
SimplifiedGeoLayerID |
A GeoLayer identifier for the output simplified GeoLayer. Refer to documentation for best practices on naming GeoLayer identifiers. | GeoLayerID``_simple_``Tolerance |
IfGeoLayerIDExists |
The action that occurs if the SimplifiedGeoLayerID already exists within the GeoProcessor:
|
Replace |
Douglas–Peucker Algorithm
The SimplifyGeoLayerGeometry
command simplifies the features of a GeoLayer with the
Douglas–Peucker algorithim
.
A line is specified by multiple points (coordinates) in sequence. The algorithm discards points as long as the resulting shift in the line connecting remaining points does not exceed the tolerance. A very small tolerance would only discard points that are "extra" points along a straight line.
Additional Resources
- Spatial Analysis 1., Spatial Data Handling
- Reducing a Map Path Using Douglas-Peucker Algorithm
- Polyline Simplification
Examples
See the automated tests.
The following GeoLayer data are used in the examples. The examples assume that the GeoLayer has already been read into the GeoProcessor from a file.
Example GeoLayer Data
GeoLayer ID | CRS | File Size (if written out to GeoJSON) |
---|---|---|
SummitCounty |
EPSG:26913 (NAD83 UTM Zone 13N) | 90 KB |
This example GeoLayer is from the polygon_summit_co_nad83_utm_z13n.geojson
test data file.
SummitCounty |
---|
Example 1: Simplify a GeoLayer (Small Tolerance)
SimplifyGeoLayerGeometry(GeoLayerID = "SummitCounty", Tolerance = "100", SimplifiedGeoLayerID = "Summit_simple100" )
After running the command, the following GeoLayer IDs are registered within the GeoProcessor.
GeoLayer ID | File Size (if written out to GeoJSON) |
---|---|
SummitCounty |
90 KB |
Summit_simple100 |
11 KB |
Summit_simple100 Tolerance Value: 100 meters |
---|
The simplified GeoLayer looks similar to the original GeoLayer. Below is an image of the two GeoLayers at a larger scale. |
---|
Example 2: Simplify a GeoLayer (Large Tolerance)
SimplifyGeoLayerGeometry(GeoLayerID = "SummitCounty", Tolerance = "1000")
After running the command, the following GeoLayer IDs are registered within the GeoProcessor.
GeoLayer ID | File Size (if written out to GeoJSON) |
---|---|
SummitCounty |
90 KB |
SummitCounty_simple_1000 |
2 KB |
SummitCounty_simple_1000 Tolerance Value: 1000 meters |
---|
Troubleshooting
See Also
- The GeoLayer is simplified using the QGIS processing algorithm
qgis:simplifygeometries
.