This function is a wrapper for sf::st_crs, unless accepting also UTM timezones (see details) and threating numeric character strings as integers.

st_crs2(x, ...)

Arguments

x

numeric, character, or object of class sf or sfc

...

other parameters passed to sf::st_crs.

Value

If x is 0 < numeric <= 60, return crs object for UTM timezone x N; if x is numeric > 60, return crs object for SRID x; if x is character in the form nn, nnN or nnS, being nn a number 0 < nn <= 60, return crs object for UTM timezone x N or x S (N if not specified); if x is a different character, return crs object for proj4string x; if wkt is given, return crs object for well-known-text representation wkt; if x is of class sf or sfc, return its crs object.

Details

See sf::st_crs for details.

Note

License: GPL 3.0

Examples

st_crs2("+init=epsg:32609")
#> Coordinate Reference System: #> EPSG: 32609 #> proj4string: "+proj=utm +zone=9 +datum=WGS84 +units=m +no_defs"
st_crs2(32609)
#> Coordinate Reference System: #> EPSG: 32609 #> proj4string: "+proj=utm +zone=9 +datum=WGS84 +units=m +no_defs"
st_crs2(9)
#> Coordinate Reference System: #> EPSG: 32609 #> proj4string: "+proj=utm +zone=9 +datum=WGS84 +units=m +no_defs"
st_crs2("09")
#> Coordinate Reference System: #> EPSG: 32609 #> proj4string: "+proj=utm +zone=9 +datum=WGS84 +units=m +no_defs"
st_crs2("9N")
#> Coordinate Reference System: #> EPSG: 32609 #> proj4string: "+proj=utm +zone=9 +datum=WGS84 +units=m +no_defs"
st_crs2("09S")
#> Coordinate Reference System: #> EPSG: 32709 #> proj4string: "+proj=utm +zone=9 +south +datum=WGS84 +units=m +no_defs"