Learn R Programming

GISTools (version 0.7-4)

generalize.polys: generalize.polys

Description

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

Usage

generalize.polys(sp, tol)

Arguments

sp
A SpatialPolygons or SpatialPolygonsDataFrame object.
tol
The weeding tolerance for the generalisation algorithm.

Value

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

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
data(georgia)
# Create an outline of Georgia
georgia.outline <- unionSpatialPolygons(georgia,rep(1,159))
plot(georgia.outline)
georgia.generalised <- generalize.polys(georgia.outline,0.1)
plot(georgia.generalised,add=TRUE,border='red')

Run the code above in your browser using DataLab