projpar: Return a parameter used in a WKT projection

View source: R/projpar.R

projparR Documentation

Return a parameter used in a WKT projection

Description

Return the value of a parameter (the name or the unit) present in the WKT of the given CRS.

Usage

projpar(x, par, abort = FALSE)

projname(x, abort = FALSE)

Arguments

x

The CRS to be named (any st_crs2 input is accepted).

par

Character corresponding to the parameter name (it can be one among "name" and "unit" - case insensitive).

abort

logical: if TRUE, the function aborts in case an invalid CRS is passed; if FALSE (default), the function returns NA, and a warning is shown.

Value

A character with the content of the parameter, and an attribute crs with the input projection checked using sf::st_crs().

Note

The old function, which was searching for a generic parameter parsing the WKT, was deprecated: now projpar() only accepts par = "name" and par = "unit", and projname() is an alias for projpar(..., par = "name").

License: GPL 3.0

Author(s)

Luigi Ranghetti, phD (2020)

References

L. Ranghetti, M. Boschetti, F. Nutini, L. Busetto (2020). "sen2r": An R toolbox for automatically downloading and preprocessing Sentinel-2 satellite data. Computers & Geosciences, 139, 104473. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1016/j.cageo.2020.104473")}, URL: https://sen2r.ranghetti.info/.

Examples


projpar(4326, "name")
projpar(4326, "unit")


projname(4326)


sen2r documentation built on Nov. 10, 2023, 9:08 a.m.