polyConstruct {RSurvey}R Documentation

Polygon Construction

Description

Read polygon information from a text file.

Usage

polyConstruct(file = NULL, dl = NULL)

Arguments

file either a character string naming a file or a connection.
dl the maximum distance between polygon vertices. If NULL, no vertices are added.

Format

The tab delineated text file, ‘*.txt’, adheres to the following 4 column format:
[,1] integer an index for vertices within a polygon.
[,2] numeric vertex location in the x-direction.
[,3] numeric vertex location in the y-direction.
[,4] integer a code, see Details.

Details

The code argument is used to identify polygons and vertex types. Letting code = 0 for two sequential vertices will override dl and prevent additional vertices from being added between them. A code < 2 indicates a vertex point is within the outer polygon. Inner polygons or holes are specified with a code > 1.

Value

A polygon of class gpc.poly-class.

Author(s)

Fisher, J. C.

See Also

polyfile

Examples

f <- system.file("RSurvey-ex/confluence-poly.txt", package = "RSurvey")
con <- file(f, open = "r", encoding = "latin1")
ply <- polyConstruct(file = con)
pts <- get.pts(ply)
plot(ply)
for(i in 1:length(pts)) points(get.pts(ply)[[i]], col = "red")

con <- file(f, open = "r", encoding = "latin1")
ply <- polyConstruct(file = con, dl = 1)
pts <- get.pts(ply)
for(i in 1:length(pts)) points(get.pts(ply)[[i]], col = "green")

[Package RSurvey version 0.4.5 Index]