Calculate the Centroids of Polygons
Calculate the centroids of polygons found in a PolySet.
calcCentroid (polys, rollup = 3)
polys |
PolySet to use. |
rollup |
level of detail in the results; |
If rollup
equals 1
, the results contain a centroid for
each unique PID
only. When it equals 2
, they contain
entries for outer contours only. Finally, setting it to 3
prevents roll-up, and they contain a centroid for each unique
(PID
, SID
).
PolyData with columns PID
, SID
(may be missing),
X
, and Y
.
Nicholas M. Boers, Associate Professor – Computer Science
MacEwan University, Edmonton AB
Last modified Rd: 2013-04-10
local(envir=.PBSmapEnv,expr={ #--- load the data (if using R) if (!is.null(version$language) && (version$language=="R")) data(nepacLL,envir=.PBSmapEnv) #--- calculate and print the centroids for several polygons print(calcCentroid(nepacLL[is.element(nepacLL$PID,c(33,39,47)),])) })
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.