convLP: Convert Polylines into a Polygon

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/PBSmapping.r

Description

Convert two polylines into a polygon.

Usage

1
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, Associate Professor – Computer Science
MacEwan University, Edmonton AB
Last modified Rd: 2013-04-10

See Also

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

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
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)
})

Example output

sh: 1: cannot create /dev/null: Permission denied

-----------------------------------------------------------
PBS Mapping 2.70.4 -- Copyright (C) 2003-2017 Fisheries and Oceans Canada

PBS Mapping comes with ABSOLUTELY NO WARRANTY;
for details see the file COPYING.
This is free software, and you are welcome to redistribute
it under certain conditions, as outlined in the above file.

A complete user guide 'PBSmapping-UG.pdf' is located at 
/usr/lib/R/site-library/PBSmapping/doc/PBSmapping-UG.pdf

Packaged on 2017-06-28
Pacific Biological Station, Nanaimo

All available PBS packages can be found at
https://github.com/pbs-software

To see demos, type '.PBSfigs()'.
-----------------------------------------------------------

PBSmapping documentation built on Jan. 15, 2021, 3:41 p.m.