Fix the POS Column of a PolySet
Fix the POS
column of a PolySet by recalculating it
using sequential integers.
fixPOS (polys, exteriorCCW = NA)
polys |
PolySet to fix. |
exteriorCCW |
Boolean value; if |
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
.
PolySet with the same columns as the input, except for possible
changes to the POS
, X
, and Y
columns.
Nicholas M. Boers, Associate Professor – Computer Science
MacEwan University, Edmonton AB
Last modified Rd: 2013-04-10
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) })
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.