Description Usage Arguments Value Functions See Also Examples
This function converts coordinates to a SpatialPolygon object. To close the polygon the last set of coordinates must be equal to the first. If they are not, then the first set is added to the end. Note that it is possible to create an improper polygon (i.e., that crosses itself).
1 2 3 4 5 | coordsToPoly(x, crs, closePoly = TRUE, id = 1)
coordsToLine(x, crs, id = 1)
coordsToLines(x, crs, id = seq_along(x))
|
x |
Either a two-column matrix or data frame with coordinates (first column is longitude, second is latitude), or a list of matrices or data frames, or an object from which coordinates can be extracted using |
crs |
A character string or an object of class |
closePoly |
Logical, if |
id |
Integer or character, ID value for the object(s). |
A spatial polygon object.
coordsToLine
: Convert coordinates to a spatial line
coordsToLines
: Convert a list of coordinates to spatial lines
1 2 3 4 5 6 7 8 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.