Description Usage Arguments Value See Also Examples
Extract the coordinates of a Spatial object
1 2 3 4 5 6 7 8 |
x |
SpatialPolygons*, SpatialLines*, or SpatialPoints* object; or a data.frame |
sepNA |
logical. If |
... |
additional arguments, none implemented |
d |
data.frame that matches the number of objects in data.frame |
gt |
character. geometry type. Must be one of "polygons", "lines", "points" |
crs |
character. PROJ.4 crs string |
Matrix with 6, (5 SpatialLines), or 3 (SpatialPoints) columns. object (sequential object number) part (sequential part number within the object; not for SpatialPoints), cump (cumulative part number; not for SpatialPoints), hole (is this a hole or not; only for SpatialPolygons), x (x coordinate or longitude), y (y coordinate or latitude)
1 2 3 4 5 6 7 8 9 | p <- readRDS(system.file("external/lux.rds", package="raster"))
x <- geom(p)
head(x)
# and back to a SpatialPolygonsDataFrame
x <- data.frame(x)
sp <- as(x, "SpatialPolygons")
crs(sp) <- crs(p)
spdf <- SpatialPolygonsDataFrame(sp, data.frame(p), match.ID=FALSE)
|
Loading required package: sp
object part cump hole x y
[1,] 1 1 1 0 6.026519 50.17767
[2,] 1 1 1 0 6.031361 50.16563
[3,] 1 1 1 0 6.035646 50.16410
[4,] 1 1 1 0 6.042747 50.16157
[5,] 1 1 1 0 6.043894 50.16116
[6,] 1 1 1 0 6.048243 50.16008
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.