bbox_to_SpatialPolygons: Create a SpatialPolygons Bounding Box

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/bbox_to_SpatialPolygons.R

Description

Create a SpatialPolygons Bounding Box

Usage

1
bbox_to_SpatialPolygons(x, proj4string = CRS(as.character(NA)))

Arguments

x

Raster*, extent, bbox or matrix. See Details.

proj4string

CRS object. Used to define the CRS if it is missing from x.

Details

This function generates a SpatialPolygons object from either a Raster* object, an extent object, a bbox object, or a 2x2 Matrix that follows the form generated by the bbox() function (rows = x and y, cols = min and max). Note that with extent and matrix objects, the CRS will need to be set manually.

Value

A SpatialPolygons object.

Author(s)

Jonathan A. Greenberg

See Also

bbox, extent

Examples

1
2
3
4
5
6
7
8
9
library("raster")
tahoe_highrez <- brick(system.file("external/tahoe_highrez.tif", package="spatial.tools"))
bbox_to_SpatialPolygons(tahoe_highrez)
tahoe_highrez_extent <- extent(tahoe_highrez)
bbox_to_SpatialPolygons(tahoe_highrez_extent,
	CRS("+proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0"))
tahoe_highrez_bbox <- bbox(tahoe_highrez)
bbox_to_SpatialPolygons(tahoe_highrez_bbox,
	CRS("+proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0"))

gearslaboratory/spatial.tools documentation built on Feb. 14, 2020, 12:36 a.m.