Last data update: 2014.03.03

R: generalize.polys
generalize.polysR Documentation

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.

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.

Value

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

Author(s)

Chris Brunsdon

Examples

# 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')

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(GISTools)
Loading required package: maptools
Loading required package: sp
Checking rgeos availability: TRUE
Loading required package: RColorBrewer
Loading required package: MASS
Loading required package: rgeos
rgeos version: 0.3-19, (SVN revision 524)
 GEOS runtime version: 3.5.0-CAPI-1.9.0 r4084 
 Linking to sp version: 1.2-3 
 Polygon checking: TRUE 

> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/GISTools/generalize.polys.Rd_%03d_medium.png", width=480, height=480)
> ### Name: generalize.polys
> ### Title: generalize.polys
> ### Aliases: generalize.polys
> 
> ### ** Examples
> 
> # 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')
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>