R/bbox.R

# R function for the raster package
# Author: Robert J. Hijmans
# Date : January 2009
# Version 0.9
# Licence GPL v3


setMethod("bbox", signature(obj="Extent"), 
	function(obj) {
		bb <- matrix(ncol=2, nrow=2)
		colnames(bb) <- c("min","max")
		rownames(bb) <- c("s1","s2")
		bb[1,1] <- obj@xmin
		bb[1,2] <- obj@xmax
		bb[2,1] <- obj@ymin
		bb[2,2] <- obj@ymax
		return(bb)
	}	
)

setMethod("bbox", signature(obj="Raster"), 
	function(obj) {
		e <- extent(obj)
		return( bbox(e) )
	}	
)

Try the raster package in your browser

Any scripts or data that you put into this service are public.

raster documentation built on Oct. 14, 2023, 5:07 p.m.