check_projection: Check the validity of the input projection

Description Usage Arguments Value Note Author(s) Examples

View source: R/check_projection.R

Description

helper function used to check that the input projection (passed as UTM zone, EPSG code, WKT string) is a valid projection for MODIStsp.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
check_projection(projection, abort = FALSE, verbose = TRUE)

## Default S3 method:
check_projection(projection, abort = FALSE, verbose = TRUE)

## S3 method for class 'numeric'
check_projection(projection, abort = FALSE, verbose = TRUE)

## S3 method for class 'character'
check_projection(projection, abort = FALSE, verbose = TRUE)

## S3 method for class 'crs'
check_projection(projection, abort = FALSE, verbose = TRUE)

Arguments

projection

character or integer corresponding to the an EPSG code, a UTM zone (e.g. "32N") or a WKT representation of a projection;

abort

logical if TRUE, the function aborts in case an invalid invalid projection is passed. Otherwise, the function returns "NA", Default: TRUE

verbose

logical if TRUE, return messages

Value

character proj4string of the object or file

Note

This function was forked from package sprawl, version 0.3.0.

Author(s)

Lorenzo Busetto, phD (2017)

Luigi Ranghetti, phD (2017) luigi@ranghetti.info

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
## Not run: 
check_projection("32632")

check_projection("32631")

check_projection(32633)

check_projection(30, abort = FALSE)

check_projection("example of invalid string", abort = FALSE)

proj_wkt <- sf::st_as_text(sf::st_crs(32632))
check_projection(proj_wkt)

## End(Not run)

MODIStsp documentation built on Jan. 13, 2021, 11:18 a.m.