Learn R Programming

GISTools (version 1.0-1)

generalize.polys: generalize.polys

Description

Generalises a SpatialPolygons or SpatialPolygonsDataFrame or a sf -POLYGON or - MULTIPOLYGON object using the Douglas-Peuker algorithm

Usage

generalize.polys(sfo, preserveTopology, dTolerance)

Value

An object of class SpatialPolygons or SpatialPolygonsDataFrame. Each polygon shape has been generalized using the Douglas-Peuker algorithm.

Arguments

sfo

A SpatialPolygons or SpatialPolygonsDataFrame or a sf -POLYGON or - MULTIPOLYGON object.

preserveTopology

logical; carry out topology preserving simplification? May be specified for each, or for all feature geometries. Note that topology is preserved only for single feature geometries, not for sets of them.

dTolerance

numeric; tolerance parameter, specified for all or for each feature geometry.

Author

Chris Brunsdon, Binbin Lu

Details

Returns an object of the same class as sp. Note that the algorithm is applied on a polygon-by-polygon, not edge-by-edge basis. Thus edges in generalised polygons may not match perfectly.

Examples

Run this code
# Data for Georgia to use in example
# \donttest{
data(WHData)
WH.outline <- st_union(WHHP)
WH.generalised <- generalize.polys(WH.outline,TRUE,0.1)
plot(st_geometry(WHHP))
plot(st_geometry(WH.generalised),add=TRUE,border='red',lwd=2)
# }

Run the code above in your browser using DataLab