# Thicken a PolySet of Polygons

### Description

Thicken a PolySet, where each unique (`PID`

, `SID`

)
describes a polygon.

### Usage

1 2 | ```
thickenPolys (polys, tol = 1, filter = 3, keepOrig = TRUE,
close = TRUE)
``` |

### Arguments

`polys` |
PolySet to thicken. |

`tol` |
tolerance (in kilometres when |

`filter` |
minimum number of vertices per result polygon. |

`keepOrig` |
Boolean value; if |

`close` |
Boolean value; if |

### Details

This function thickens each polygon within `polys`

according to
the input arguments.

If `keepOrig = TRUE`

, all of the original vertices appear in the
result. It calculates the distance between two sequential original
vertices, and if that distance exceeds `tol`

, it adds a
sufficient number of vertices spaced evenly between the two original
vertices so that the distance between vertices no longer exceeds
`tol`

. If `close = TRUE`

, it adds intermediate vertices
between the last and first vertices when necessary.

If `keepOrig = FALSE`

, only the first vertex of each polygon is
guaranteed to appear in the results. From this first vertex, the
algorithm walks the polygon summing the distance between vertices.
When this cumulative distance exceeds `tol`

, it adds a vertex on
the line segment under inspection. After doing so, it resets the
distance sum, and walks the polygon from this new vertex. If
`close = TRUE`

, it will walk the line segment from the last
vertex to the first.

### Value

PolySet containing the thickened data. The function
recalculates the `POS`

values for each polygon.

### See Also

`thinPolys`

.

### Examples

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | ```
local(envir=.PBSmapEnv,expr={
oldpar = par(no.readonly=TRUE)
#--- load the data (if using R)
if (!is.null(version$language) && (version$language=="R"))
data(nepacLL,envir=.PBSmapEnv)
#--- plot Vancouver Island
plotMap(nepacLL[nepacLL$PID == 33, ])
#--- calculate a thickened version using a 30 kilometres tolerance,
#--- without keeping the original points
p <- thickenPolys(nepacLL[nepacLL$PID == 33, ], tol = 30, keepOrig = FALSE)
#--- convert the PolySet to EventData by dropping the PID column and
#--- renaming POS to EID
p <- p[-1]; names(p)[1] <- "EID"
#--- convert the now invalid PolySet into a data frame, and then into
#--- EventData
p <- as.EventData(as.data.frame(p), projection="LL")
#--- plot the results
addPoints(p, col=2, pch=19)
par(oldpar)
})
``` |

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker. Vote for new features on Trello.