st_crs2: Retrieve coordinate reference system from 'sf' or 'sfc'...

View source: R/st_crs2.R

st_crs2R Documentation

Retrieve coordinate reference system from sf or sfc object

Description

This function, forked from sen2r::st_crs2(), is a wrapper for sf::st_crs(), unless treating numeric character strings as integers, and accepting also UTM time zones, paths of spatial files and paths of text files containing WKT like .prj (see details) .

Usage

st_crs2(x, ...)

Arguments

x

numeric, character, or object of class sf or sfc, being:

  • EPSG code: numeric (e.g. 32632) or character (in the form "32632" or "EPSG:32632");

  • UTM zone: numeric (e.g. 32, interpreted as 32 North) or character (e.g. "32" or "32N" for zone 32 North, "32S" for 32 South);

  • WKT test: passed as character string or as path of a text file containing it (e.g. the path of a .prj file);

  • PROJ.4 string, passed as character (e.g. "+proj=utm +zone=32 +datum=WGS84 +units=m +no_defs" (NOTE: this representation is deprecated with PROJ >= 6 – see http://rgdal.r-forge.r-project.org/articles/PROJ6_GDAL3.html – so a warning is returned using it, unless the string contains only the EPSG code – e.g. "+init=epsg:32632", in which case the EPSG code is taken);

  • path of a spatial file (managed by sf::st_read() or stars::read_stars()), passed as character string of length 1;

  • spatial file of class sf or sfc.

...

other parameters passed to sf::st_crs().

Details

See sf::st_crs() for details.

Value

An object of class crs of length 2.

Note

License: GPL 3.0

Author(s)

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

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. DOI: https://doi.org/10.1016/j.cageo.2020.104473, URL: http://sen2r.ranghetti.info/.


ranghetti/guinterp documentation built on March 30, 2024, 3:42 a.m.