Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

fixPOS

Fix the POS Column of a PolySet


Description

Fix the POS column of a PolySet by recalculating it using sequential integers.

Usage

fixPOS (polys, exteriorCCW = NA)

Arguments

polys

PolySet to fix.

exteriorCCW

Boolean value; if TRUE, orders exterior polygon vertices in a counter-clockwise direction. If FALSE, orders them in a clockwise direction. If NA, maintains their original order.

Details

This function recalculates the POS values of each (PID, SID) as either 1 to N or N to 1, depending on the order of POS (ascending or descending) in the input data. POS values in the input must be properly ordered (ascending or descending), but they may contain fractional values. For example, POS = 2.5 might correspond to a point manually added between POS = 2 and POS = 3. If exteriorCCW = NA, all other columns remain unchanged. Otherwise, it orders the X and Y columns according to exteriorCCW.

Value

PolySet with the same columns as the input, except for possible changes to the POS, X, and Y columns.

Author(s)

Nicholas M. Boers, Associate Professor – Computer Science
MacEwan University, Edmonton AB
Last modified Rd: 2013-04-10

See Also

Examples

local(envir=.PBSmapEnv,expr={
  #--- create a PolySet with broken POS numbering
  polys <- data.frame(PID = c(rep(1, 10), rep(2, 10)),
    POS = c(seq(2, 10, length = 10), seq(10, 2, length = 10)),
    X = c(rep(1, 10), rep(1, 10)),
    Y = c(rep(1, 10), rep(1, 10)))
  #--- fix the POS numbering
  polys <- fixPOS(polys)
  #--- print the results
  print(polys)
})

PBSmapping

Mapping Fisheries Data and Spatial Analysis Tools

v2.73.0
GPL (>= 2)
Authors
Jon T. Schnute [aut], Nicholas Boers [aut], Rowan Haigh [aut, cre], Alex Couture-Beil [ctb], Denis Chabot [ctb], Chris Grandin [ctb], Angus Johnson [ctb], Paul Wessel [ctb], Franklin Antonio [ctb], Nicholas J. Lewin-Koh [ctb], Roger Bivand [ctb]
Initial release
2021-01-12

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.