get_projstring: return the proj4string of a spatial object or file

Description Usage Arguments Details Value Author(s) Examples

View source: R/get_projstring.R

Description

helper function used to extract the proj4string of "R" spatial objects or of raster or vector files

Usage

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

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

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

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

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

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

## S3 method for class 'Spatial'
get_projstring(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

DETAILS

Value

character proj4string of the object or file

Author(s)

Lorenzo Busetto, phD (2017) [email protected]

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_projstring(in_rast)

 in_rast <- raster::raster(in_rast)
 get_projstring(in_rast)

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

 in_vect <- read_vect(in_vect)
 get_projstring(in_vect)

 
## End(Not run)

IREA-CNR-MI/sprawl documentation built on Aug. 6, 2017, 12:56 p.m.