convLP: Convert Polylines into a Polygon

View source: R/PBSmapping.r

convLPR Documentation

Convert Polylines into a Polygon

Description

Convert two polylines into a polygon.

Usage

convLP (polyA, polyB, reverse = TRUE)

Arguments

polyA

PolySet containing a polyline.

polyB

PolySet containing a polyline.

reverse

Boolean value; if TRUE, reverse polyB's vertices.

Details

The resulting PolySet contains all the vertices from polyA in their original order. If reverse = TRUE, this function appends the vertices from polyB in the reverse order (nrow(polyB):1). Otherwise, it appends them in their original order. The PID column equals the PID of polyA. No SID column appears in the result. The resulting polygon is an exterior boundary.

Value

PolySet with a single PID that is the same as polyA. The result contains all the vertices in polyA and polyB. It has the same projection and zone attributes as those in the input PolySets. If an input PolySet's attributes equal NULL, the function uses the other PolySet's. If the PolySet attributes conflict, the result's attribute equals NULL.

Author(s)

Nicholas M. Boers, Staff Software Engineer
Jobber, Edmonton AB
Last modified Rd: 2013-04-10

See Also

addLines, appendPolys, closePolys, convCP, joinPolys, plotLines.

Examples

local(envir=.PBSmapEnv,expr={
  oldpar = par(no.readonly=TRUE)
  #--- create two polylines
  polyline1 <- data.frame(PID=rep(1,2),POS=1:2,X=c(1,4),Y=c(1,4))
  polyline2 <- data.frame(PID=rep(1,2),POS=1:2,X=c(2,5),Y=c(1,4))
  #--- create two plots to demonstrate the effect of `reverse'
  par(mfrow=c(2, 1))
  plotPolys(convLP(polyline1, polyline2, reverse=TRUE), col=2)
  plotPolys(convLP(polyline1, polyline2, reverse=FALSE), col=3)
  par(oldpar)
})

PBSmapping documentation built on Nov. 4, 2023, 9:08 a.m.