get_extent: return the exten of a spatial object or file (with...

Description Usage Arguments Details Value Author(s) Examples

View source: R/get_extent.R

Description

helper function used to retrieve the extent of a spatial object or file with the associated proj4string

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
get_extent(object, abort = FALSE)

## Default S3 method:
get_extent(object, abort = FALSE)

## S3 method for class 'character'
get_extent(object, abort = FALSE)

## S3 method for class 'Raster'
get_extent(object, abort = FALSE)

## S3 method for class 'sf'
get_extent(object, abort = FALSE)

## S3 method for class 'sfc'
get_extent(object, abort = FALSE)

## S3 method for class 'Spatial'
get_extent(object, abort = FALSE)

Arguments

object

character corresponding to the name of a R object, or a filename (full path)

abort

logical if TRUE, the function aborts in case no proj4string or invalid projstring is found, Default: FALSE

Details

return an object of class sprawl_ext with two slots:

Value

object of class sprawl_ext

Author(s)

Lorenzo Busetto, phD (2017) lbusett@gmail.com

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
## Not run: 
 library(raster)

 in_rast <- system.file("extdata", "sprawl_EVItest.tif", package = "sprawl.data")
 get_extent(in_rast)

 in_rast <- raster::raster(in_rast)
 get_extent(in_rast)

 in_vect <- system.file("extdata","lc_polys.shp", package = "sprawl.data")
 get_extent(in_vect)

 in_vect <- read_vect(in_vect)
 get_extent(in_vect)


## End(Not run)

IREA-CNR-MI/sprawl documentation built on May 27, 2019, 1:12 p.m.