geom

0th

Percentile

Get the coordinates of a vector type Spatial* object

Extract the coordinates of a Spatial object

Keywords
methods, spatial
Usage
# S4 method for SpatialPolygons
geom(x, sepNA=FALSE, ...)
# S4 method for SpatialLines
geom(x, sepNA=FALSE, ...)
# S4 method for SpatialPoints
geom(x, ...)
# S4 method for data.frame
geom(x, d, gt, crs, ...)
Arguments
x

SpatialPolygons*, SpatialLines*, or SpatialPoints* object; or a data.frame

sepNA

logical. If TRUE, geometries are separated by a row with NA values

...

additional arguments, none implemented

d

data.frame that matches the number of objects in data.frame x

gt

character. geometry type. Must be one of "polygons", "lines", "points"

crs

character. PROJ.4 crs string

Value

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)

See Also

coordinates, geometry

Aliases
  • geom
  • geom,SpatialPolygons-method
  • geom,SpatialLines-method
  • geom,SpatialPoints-method
  • geom,data.frame-method
Examples
# NOT RUN {
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)
# }
Documentation reproduced from package raster, version 3.0-12, License: GPL (>= 3)

Community examples

Looks like there are no examples yet.