This function is a wrapper for sf::st_crs, unless threating numeric character strings as integers, and accepting also UTM timezones, paths of spatial files and paths of text files containing WKT like .prj (see details) .

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.

Value

An object of class crs of length 2.

Details

See sf::st_crs for details.

Note

License: GPL 3.0

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

Author

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

Examples

## CRS from EPSG st_crs2(32609)
#> Coordinate Reference System: #> User input: EPSG:32609 #> wkt: #> PROJCRS["WGS 84 / UTM zone 9N", #> BASEGEOGCRS["WGS 84", #> DATUM["World Geodetic System 1984", #> ELLIPSOID["WGS 84",6378137,298.257223563, #> LENGTHUNIT["metre",1]]], #> PRIMEM["Greenwich",0, #> ANGLEUNIT["degree",0.0174532925199433]], #> ID["EPSG",4326]], #> CONVERSION["UTM zone 9N", #> METHOD["Transverse Mercator", #> ID["EPSG",9807]], #> PARAMETER["Latitude of natural origin",0, #> ANGLEUNIT["degree",0.0174532925199433], #> ID["EPSG",8801]], #> PARAMETER["Longitude of natural origin",-129, #> ANGLEUNIT["degree",0.0174532925199433], #> ID["EPSG",8802]], #> PARAMETER["Scale factor at natural origin",0.9996, #> SCALEUNIT["unity",1], #> ID["EPSG",8805]], #> PARAMETER["False easting",500000, #> LENGTHUNIT["metre",1], #> ID["EPSG",8806]], #> PARAMETER["False northing",0, #> LENGTHUNIT["metre",1], #> ID["EPSG",8807]]], #> CS[Cartesian,2], #> AXIS["(E)",east, #> ORDER[1], #> LENGTHUNIT["metre",1]], #> AXIS["(N)",north, #> ORDER[2], #> LENGTHUNIT["metre",1]], #> USAGE[ #> SCOPE["Engineering survey, topographic mapping."], #> AREA["Between 132°W and 126°W, northern hemisphere between equator and 84°N, onshore and offshore. Canada - British Columbia (BC); NorthW Territories (NWT); Yukon. United States (USA) - Alaska (AK)."], #> BBOX[0,-132,84,-126]], #> ID["EPSG",32609]]
st_crs2("EPSG:32609")
#> Coordinate Reference System: #> User input: EPSG:32609 #> wkt: #> PROJCRS["WGS 84 / UTM zone 9N", #> BASEGEOGCRS["WGS 84", #> DATUM["World Geodetic System 1984", #> ELLIPSOID["WGS 84",6378137,298.257223563, #> LENGTHUNIT["metre",1]]], #> PRIMEM["Greenwich",0, #> ANGLEUNIT["degree",0.0174532925199433]], #> ID["EPSG",4326]], #> CONVERSION["UTM zone 9N", #> METHOD["Transverse Mercator", #> ID["EPSG",9807]], #> PARAMETER["Latitude of natural origin",0, #> ANGLEUNIT["degree",0.0174532925199433], #> ID["EPSG",8801]], #> PARAMETER["Longitude of natural origin",-129, #> ANGLEUNIT["degree",0.0174532925199433], #> ID["EPSG",8802]], #> PARAMETER["Scale factor at natural origin",0.9996, #> SCALEUNIT["unity",1], #> ID["EPSG",8805]], #> PARAMETER["False easting",500000, #> LENGTHUNIT["metre",1], #> ID["EPSG",8806]], #> PARAMETER["False northing",0, #> LENGTHUNIT["metre",1], #> ID["EPSG",8807]]], #> CS[Cartesian,2], #> AXIS["(E)",east, #> ORDER[1], #> LENGTHUNIT["metre",1]], #> AXIS["(N)",north, #> ORDER[2], #> LENGTHUNIT["metre",1]], #> USAGE[ #> SCOPE["Engineering survey, topographic mapping."], #> AREA["Between 132°W and 126°W, northern hemisphere between equator and 84°N, onshore and offshore. Canada - British Columbia (BC); NorthW Territories (NWT); Yukon. United States (USA) - Alaska (AK)."], #> BBOX[0,-132,84,-126]], #> ID["EPSG",32609]]
## CRS from UTM zone st_crs2(9)
#> Coordinate Reference System: #> User input: EPSG:32609 #> wkt: #> PROJCRS["WGS 84 / UTM zone 9N", #> BASEGEOGCRS["WGS 84", #> DATUM["World Geodetic System 1984", #> ELLIPSOID["WGS 84",6378137,298.257223563, #> LENGTHUNIT["metre",1]]], #> PRIMEM["Greenwich",0, #> ANGLEUNIT["degree",0.0174532925199433]], #> ID["EPSG",4326]], #> CONVERSION["UTM zone 9N", #> METHOD["Transverse Mercator", #> ID["EPSG",9807]], #> PARAMETER["Latitude of natural origin",0, #> ANGLEUNIT["degree",0.0174532925199433], #> ID["EPSG",8801]], #> PARAMETER["Longitude of natural origin",-129, #> ANGLEUNIT["degree",0.0174532925199433], #> ID["EPSG",8802]], #> PARAMETER["Scale factor at natural origin",0.9996, #> SCALEUNIT["unity",1], #> ID["EPSG",8805]], #> PARAMETER["False easting",500000, #> LENGTHUNIT["metre",1], #> ID["EPSG",8806]], #> PARAMETER["False northing",0, #> LENGTHUNIT["metre",1], #> ID["EPSG",8807]]], #> CS[Cartesian,2], #> AXIS["(E)",east, #> ORDER[1], #> LENGTHUNIT["metre",1]], #> AXIS["(N)",north, #> ORDER[2], #> LENGTHUNIT["metre",1]], #> USAGE[ #> SCOPE["Engineering survey, topographic mapping."], #> AREA["Between 132°W and 126°W, northern hemisphere between equator and 84°N, onshore and offshore. Canada - British Columbia (BC); NorthW Territories (NWT); Yukon. United States (USA) - Alaska (AK)."], #> BBOX[0,-132,84,-126]], #> ID["EPSG",32609]]
st_crs2("09")
#> Coordinate Reference System: #> User input: EPSG:32609 #> wkt: #> PROJCRS["WGS 84 / UTM zone 9N", #> BASEGEOGCRS["WGS 84", #> DATUM["World Geodetic System 1984", #> ELLIPSOID["WGS 84",6378137,298.257223563, #> LENGTHUNIT["metre",1]]], #> PRIMEM["Greenwich",0, #> ANGLEUNIT["degree",0.0174532925199433]], #> ID["EPSG",4326]], #> CONVERSION["UTM zone 9N", #> METHOD["Transverse Mercator", #> ID["EPSG",9807]], #> PARAMETER["Latitude of natural origin",0, #> ANGLEUNIT["degree",0.0174532925199433], #> ID["EPSG",8801]], #> PARAMETER["Longitude of natural origin",-129, #> ANGLEUNIT["degree",0.0174532925199433], #> ID["EPSG",8802]], #> PARAMETER["Scale factor at natural origin",0.9996, #> SCALEUNIT["unity",1], #> ID["EPSG",8805]], #> PARAMETER["False easting",500000, #> LENGTHUNIT["metre",1], #> ID["EPSG",8806]], #> PARAMETER["False northing",0, #> LENGTHUNIT["metre",1], #> ID["EPSG",8807]]], #> CS[Cartesian,2], #> AXIS["(E)",east, #> ORDER[1], #> LENGTHUNIT["metre",1]], #> AXIS["(N)",north, #> ORDER[2], #> LENGTHUNIT["metre",1]], #> USAGE[ #> SCOPE["Engineering survey, topographic mapping."], #> AREA["Between 132°W and 126°W, northern hemisphere between equator and 84°N, onshore and offshore. Canada - British Columbia (BC); NorthW Territories (NWT); Yukon. United States (USA) - Alaska (AK)."], #> BBOX[0,-132,84,-126]], #> ID["EPSG",32609]]
st_crs2("9N")
#> Coordinate Reference System: #> User input: EPSG:32609 #> wkt: #> PROJCRS["WGS 84 / UTM zone 9N", #> BASEGEOGCRS["WGS 84", #> DATUM["World Geodetic System 1984", #> ELLIPSOID["WGS 84",6378137,298.257223563, #> LENGTHUNIT["metre",1]]], #> PRIMEM["Greenwich",0, #> ANGLEUNIT["degree",0.0174532925199433]], #> ID["EPSG",4326]], #> CONVERSION["UTM zone 9N", #> METHOD["Transverse Mercator", #> ID["EPSG",9807]], #> PARAMETER["Latitude of natural origin",0, #> ANGLEUNIT["degree",0.0174532925199433], #> ID["EPSG",8801]], #> PARAMETER["Longitude of natural origin",-129, #> ANGLEUNIT["degree",0.0174532925199433], #> ID["EPSG",8802]], #> PARAMETER["Scale factor at natural origin",0.9996, #> SCALEUNIT["unity",1], #> ID["EPSG",8805]], #> PARAMETER["False easting",500000, #> LENGTHUNIT["metre",1], #> ID["EPSG",8806]], #> PARAMETER["False northing",0, #> LENGTHUNIT["metre",1], #> ID["EPSG",8807]]], #> CS[Cartesian,2], #> AXIS["(E)",east, #> ORDER[1], #> LENGTHUNIT["metre",1]], #> AXIS["(N)",north, #> ORDER[2], #> LENGTHUNIT["metre",1]], #> USAGE[ #> SCOPE["Engineering survey, topographic mapping."], #> AREA["Between 132°W and 126°W, northern hemisphere between equator and 84°N, onshore and offshore. Canada - British Columbia (BC); NorthW Territories (NWT); Yukon. United States (USA) - Alaska (AK)."], #> BBOX[0,-132,84,-126]], #> ID["EPSG",32609]]
st_crs2("09S")
#> Coordinate Reference System: #> User input: EPSG:32709 #> wkt: #> PROJCRS["WGS 84 / UTM zone 9S", #> BASEGEOGCRS["WGS 84", #> DATUM["World Geodetic System 1984", #> ELLIPSOID["WGS 84",6378137,298.257223563, #> LENGTHUNIT["metre",1]]], #> PRIMEM["Greenwich",0, #> ANGLEUNIT["degree",0.0174532925199433]], #> ID["EPSG",4326]], #> CONVERSION["UTM zone 9S", #> METHOD["Transverse Mercator", #> ID["EPSG",9807]], #> PARAMETER["Latitude of natural origin",0, #> ANGLEUNIT["degree",0.0174532925199433], #> ID["EPSG",8801]], #> PARAMETER["Longitude of natural origin",-129, #> ANGLEUNIT["degree",0.0174532925199433], #> ID["EPSG",8802]], #> PARAMETER["Scale factor at natural origin",0.9996, #> SCALEUNIT["unity",1], #> ID["EPSG",8805]], #> PARAMETER["False easting",500000, #> LENGTHUNIT["metre",1], #> ID["EPSG",8806]], #> PARAMETER["False northing",10000000, #> LENGTHUNIT["metre",1], #> ID["EPSG",8807]]], #> CS[Cartesian,2], #> AXIS["(E)",east, #> ORDER[1], #> LENGTHUNIT["metre",1]], #> AXIS["(N)",north, #> ORDER[2], #> LENGTHUNIT["metre",1]], #> USAGE[ #> SCOPE["Engineering survey, topographic mapping."], #> AREA["Between 132°W and 126°W, southern hemisphere between 80°S and equator, onshore and offshore."], #> BBOX[-80,-132,0,-126]], #> ID["EPSG",32709]]
## CRS from WKT (string or path) (wkt_32n <- sf::st_as_text(sf::st_crs(32609)))
#> [1] "PROJCS[\"WGS 84 / UTM zone 9N\",GEOGCS[\"WGS 84\",DATUM[\"WGS_1984\",SPHEROID[\"WGS 84\",6378137,298.257223563]],PRIMEM[\"Greenwich\",0],UNIT[\"degree\",0.0174532925199433,AUTHORITY[\"EPSG\",\"9122\"]],AUTHORITY[\"EPSG\",\"4326\"]],PROJECTION[\"Transverse_Mercator\"],PARAMETER[\"latitude_of_origin\",0],PARAMETER[\"central_meridian\",-129],PARAMETER[\"scale_factor\",0.9996],PARAMETER[\"false_easting\",500000],PARAMETER[\"false_northing\",0],UNIT[\"metre\",1],AXIS[\"Easting\",EAST],AXIS[\"Northing\",NORTH],AUTHORITY[\"EPSG\",\"32609\"]]"
st_crs2(wkt_32n)
#> Coordinate Reference System: #> User input: PROJCS["WGS 84 / UTM zone 9N",GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4326"]],PROJECTION["Transverse_Mercator"],PARAMETER["latitude_of_origin",0],PARAMETER["central_meridian",-129],PARAMETER["scale_factor",0.9996],PARAMETER["false_easting",500000],PARAMETER["false_northing",0],UNIT["metre",1],AXIS["Easting",EAST],AXIS["Northing",NORTH],AUTHORITY["EPSG","32609"]] #> wkt: #> PROJCRS["WGS 84 / UTM zone 9N", #> BASEGEOGCRS["WGS 84", #> DATUM["World Geodetic System 1984", #> ELLIPSOID["WGS 84",6378137,298.257223563, #> LENGTHUNIT["metre",1]]], #> PRIMEM["Greenwich",0, #> ANGLEUNIT["degree",0.0174532925199433]], #> ID["EPSG",4326]], #> CONVERSION["UTM zone 9N", #> METHOD["Transverse Mercator", #> ID["EPSG",9807]], #> PARAMETER["Latitude of natural origin",0, #> ANGLEUNIT["degree",0.0174532925199433], #> ID["EPSG",8801]], #> PARAMETER["Longitude of natural origin",-129, #> ANGLEUNIT["degree",0.0174532925199433], #> ID["EPSG",8802]], #> PARAMETER["Scale factor at natural origin",0.9996, #> SCALEUNIT["unity",1], #> ID["EPSG",8805]], #> PARAMETER["False easting",500000, #> LENGTHUNIT["metre",1], #> ID["EPSG",8806]], #> PARAMETER["False northing",0, #> LENGTHUNIT["metre",1], #> ID["EPSG",8807]]], #> CS[Cartesian,2], #> AXIS["easting",east, #> ORDER[1], #> LENGTHUNIT["metre",1]], #> AXIS["northing",north, #> ORDER[2], #> LENGTHUNIT["metre",1]], #> ID["EPSG",32609]]
writeLines(wkt_32n, wkt_32n_path <- tempfile()) st_crs2(wkt_32n_path)
#> Coordinate Reference System: #> User input: PROJCS["WGS 84 / UTM zone 9N",GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4326"]],PROJECTION["Transverse_Mercator"],PARAMETER["latitude_of_origin",0],PARAMETER["central_meridian",-129],PARAMETER["scale_factor",0.9996],PARAMETER["false_easting",500000],PARAMETER["false_northing",0],UNIT["metre",1],AXIS["Easting",EAST],AXIS["Northing",NORTH],AUTHORITY["EPSG","32609"]] #> wkt: #> PROJCRS["WGS 84 / UTM zone 9N", #> BASEGEOGCRS["WGS 84", #> DATUM["World Geodetic System 1984", #> ELLIPSOID["WGS 84",6378137,298.257223563, #> LENGTHUNIT["metre",1]]], #> PRIMEM["Greenwich",0, #> ANGLEUNIT["degree",0.0174532925199433]], #> ID["EPSG",4326]], #> CONVERSION["UTM zone 9N", #> METHOD["Transverse Mercator", #> ID["EPSG",9807]], #> PARAMETER["Latitude of natural origin",0, #> ANGLEUNIT["degree",0.0174532925199433], #> ID["EPSG",8801]], #> PARAMETER["Longitude of natural origin",-129, #> ANGLEUNIT["degree",0.0174532925199433], #> ID["EPSG",8802]], #> PARAMETER["Scale factor at natural origin",0.9996, #> SCALEUNIT["unity",1], #> ID["EPSG",8805]], #> PARAMETER["False easting",500000, #> LENGTHUNIT["metre",1], #> ID["EPSG",8806]], #> PARAMETER["False northing",0, #> LENGTHUNIT["metre",1], #> ID["EPSG",8807]]], #> CS[Cartesian,2], #> AXIS["easting",east, #> ORDER[1], #> LENGTHUNIT["metre",1]], #> AXIS["northing",north, #> ORDER[2], #> LENGTHUNIT["metre",1]], #> ID["EPSG",32609]]
## CRS from spatial file path raster_path <- system.file( "extdata/out/S2A2A_20190723_022_Barbellino_BOA_10.tif", package="sen2r" ) vector_path <- system.file( "extdata/vector/barbellino.geojson", package="sen2r" ) st_crs2(raster_path)
#> Coordinate Reference System: #> User input: PROJCS["WGS 84 / UTM zone 32N",GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4326"]],PROJECTION["Transverse_Mercator"],PARAMETER["latitude_of_origin",0],PARAMETER["central_meridian",9],PARAMETER["scale_factor",0.9996],PARAMETER["false_easting",500000],PARAMETER["false_northing",0],UNIT["metre",1,AUTHORITY["EPSG","9001"]],AXIS["Easting",EAST],AXIS["Northing",NORTH],AUTHORITY["EPSG","32632"]] #> wkt: #> PROJCRS["WGS 84 / UTM zone 32N", #> BASEGEOGCRS["WGS 84", #> DATUM["World Geodetic System 1984", #> ELLIPSOID["WGS 84",6378137,298.257223563, #> LENGTHUNIT["metre",1]]], #> PRIMEM["Greenwich",0, #> ANGLEUNIT["degree",0.0174532925199433]], #> ID["EPSG",4326]], #> CONVERSION["UTM zone 32N", #> METHOD["Transverse Mercator", #> ID["EPSG",9807]], #> PARAMETER["Latitude of natural origin",0, #> ANGLEUNIT["degree",0.0174532925199433], #> ID["EPSG",8801]], #> PARAMETER["Longitude of natural origin",9, #> ANGLEUNIT["degree",0.0174532925199433], #> ID["EPSG",8802]], #> PARAMETER["Scale factor at natural origin",0.9996, #> SCALEUNIT["unity",1], #> ID["EPSG",8805]], #> PARAMETER["False easting",500000, #> LENGTHUNIT["metre",1], #> ID["EPSG",8806]], #> PARAMETER["False northing",0, #> LENGTHUNIT["metre",1], #> ID["EPSG",8807]]], #> CS[Cartesian,2], #> AXIS["easting",east, #> ORDER[1], #> LENGTHUNIT["metre",1]], #> AXIS["northing",north, #> ORDER[2], #> LENGTHUNIT["metre",1]], #> ID["EPSG",32632]]
st_crs2(vector_path)
#> Coordinate Reference System: #> User input: WGS 84 / UTM zone 32N #> wkt: #> PROJCRS["WGS 84 / UTM zone 32N", #> BASEGEOGCRS["WGS 84", #> DATUM["World Geodetic System 1984", #> ELLIPSOID["WGS 84",6378137,298.257223563, #> LENGTHUNIT["metre",1]]], #> PRIMEM["Greenwich",0, #> ANGLEUNIT["degree",0.0174532925199433]], #> ID["EPSG",4326]], #> CONVERSION["UTM zone 32N", #> METHOD["Transverse Mercator", #> ID["EPSG",9807]], #> PARAMETER["Latitude of natural origin",0, #> ANGLEUNIT["degree",0.0174532925199433], #> ID["EPSG",8801]], #> PARAMETER["Longitude of natural origin",9, #> ANGLEUNIT["degree",0.0174532925199433], #> ID["EPSG",8802]], #> PARAMETER["Scale factor at natural origin",0.9996, #> SCALEUNIT["unity",1], #> ID["EPSG",8805]], #> PARAMETER["False easting",500000, #> LENGTHUNIT["metre",1], #> ID["EPSG",8806]], #> PARAMETER["False northing",0, #> LENGTHUNIT["metre",1], #> ID["EPSG",8807]]], #> CS[Cartesian,2], #> AXIS["(E)",east, #> ORDER[1], #> LENGTHUNIT["metre",1]], #> AXIS["(N)",north, #> ORDER[2], #> LENGTHUNIT["metre",1]], #> USAGE[ #> SCOPE["Engineering survey, topographic mapping."], #> AREA["Between 6°E and 12°E, northern hemisphere between equator and 84°N, onshore and offshore. Algeria. Austria. Cameroon. Denmark. Equatorial Guinea. France. Gabon. Germany. Italy. Libya. Liechtenstein. Monaco. Netherlands. Niger. Nigeria. Norway. Sao Tome and Principe. Svalbard. Sweden. Switzerland. Tunisia. Vatican City State."], #> BBOX[0,6,84,12]], #> ID["EPSG",32632]]
## CRS from spatial files st_crs2(stars::read_stars(raster_path))
#> Coordinate Reference System: #> User input: WGS 84 / UTM zone 32N #> wkt: #> PROJCRS["WGS 84 / UTM zone 32N", #> BASEGEOGCRS["WGS 84", #> DATUM["World Geodetic System 1984", #> ELLIPSOID["WGS 84",6378137,298.257223563, #> LENGTHUNIT["metre",1]]], #> PRIMEM["Greenwich",0, #> ANGLEUNIT["degree",0.0174532925199433]], #> ID["EPSG",4326]], #> CONVERSION["UTM zone 32N", #> METHOD["Transverse Mercator", #> ID["EPSG",9807]], #> PARAMETER["Latitude of natural origin",0, #> ANGLEUNIT["degree",0.0174532925199433], #> ID["EPSG",8801]], #> PARAMETER["Longitude of natural origin",9, #> ANGLEUNIT["degree",0.0174532925199433], #> ID["EPSG",8802]], #> PARAMETER["Scale factor at natural origin",0.9996, #> SCALEUNIT["unity",1], #> ID["EPSG",8805]], #> PARAMETER["False easting",500000, #> LENGTHUNIT["metre",1], #> ID["EPSG",8806]], #> PARAMETER["False northing",0, #> LENGTHUNIT["metre",1], #> ID["EPSG",8807]]], #> CS[Cartesian,2], #> AXIS["(E)",east, #> ORDER[1], #> LENGTHUNIT["metre",1]], #> AXIS["(N)",north, #> ORDER[2], #> LENGTHUNIT["metre",1]], #> USAGE[ #> SCOPE["Engineering survey, topographic mapping."], #> AREA["Between 6°E and 12°E, northern hemisphere between equator and 84°N, onshore and offshore. Algeria. Austria. Cameroon. Denmark. Equatorial Guinea. France. Gabon. Germany. Italy. Libya. Liechtenstein. Monaco. Netherlands. Niger. Nigeria. Norway. Sao Tome and Principe. Svalbard. Sweden. Switzerland. Tunisia. Vatican City State."], #> BBOX[0,6,84,12]], #> ID["EPSG",32632]]
st_crs2(sf::read_sf(vector_path))
#> Coordinate Reference System: #> User input: WGS 84 / UTM zone 32N #> wkt: #> PROJCRS["WGS 84 / UTM zone 32N", #> BASEGEOGCRS["WGS 84", #> DATUM["World Geodetic System 1984", #> ELLIPSOID["WGS 84",6378137,298.257223563, #> LENGTHUNIT["metre",1]]], #> PRIMEM["Greenwich",0, #> ANGLEUNIT["degree",0.0174532925199433]], #> ID["EPSG",4326]], #> CONVERSION["UTM zone 32N", #> METHOD["Transverse Mercator", #> ID["EPSG",9807]], #> PARAMETER["Latitude of natural origin",0, #> ANGLEUNIT["degree",0.0174532925199433], #> ID["EPSG",8801]], #> PARAMETER["Longitude of natural origin",9, #> ANGLEUNIT["degree",0.0174532925199433], #> ID["EPSG",8802]], #> PARAMETER["Scale factor at natural origin",0.9996, #> SCALEUNIT["unity",1], #> ID["EPSG",8805]], #> PARAMETER["False easting",500000, #> LENGTHUNIT["metre",1], #> ID["EPSG",8806]], #> PARAMETER["False northing",0, #> LENGTHUNIT["metre",1], #> ID["EPSG",8807]]], #> CS[Cartesian,2], #> AXIS["(E)",east, #> ORDER[1], #> LENGTHUNIT["metre",1]], #> AXIS["(N)",north, #> ORDER[2], #> LENGTHUNIT["metre",1]], #> USAGE[ #> SCOPE["Engineering survey, topographic mapping."], #> AREA["Between 6°E and 12°E, northern hemisphere between equator and 84°N, onshore and offshore. Algeria. Austria. Cameroon. Denmark. Equatorial Guinea. France. Gabon. Germany. Italy. Libya. Liechtenstein. Monaco. Netherlands. Niger. Nigeria. Norway. Sao Tome and Principe. Svalbard. Sweden. Switzerland. Tunisia. Vatican City State."], #> BBOX[0,6,84,12]], #> ID["EPSG",32632]]
# \donttest{ ## CRS from PROJ.4 string # (avoid using this with PROJ >= 6!) st_crs2("+init=epsg:32609") # this makes use of the EPSG code
#> Coordinate Reference System: #> User input: EPSG:32609 #> wkt: #> PROJCRS["WGS 84 / UTM zone 9N", #> BASEGEOGCRS["WGS 84", #> DATUM["World Geodetic System 1984", #> ELLIPSOID["WGS 84",6378137,298.257223563, #> LENGTHUNIT["metre",1]]], #> PRIMEM["Greenwich",0, #> ANGLEUNIT["degree",0.0174532925199433]], #> ID["EPSG",4326]], #> CONVERSION["UTM zone 9N", #> METHOD["Transverse Mercator", #> ID["EPSG",9807]], #> PARAMETER["Latitude of natural origin",0, #> ANGLEUNIT["degree",0.0174532925199433], #> ID["EPSG",8801]], #> PARAMETER["Longitude of natural origin",-129, #> ANGLEUNIT["degree",0.0174532925199433], #> ID["EPSG",8802]], #> PARAMETER["Scale factor at natural origin",0.9996, #> SCALEUNIT["unity",1], #> ID["EPSG",8805]], #> PARAMETER["False easting",500000, #> LENGTHUNIT["metre",1], #> ID["EPSG",8806]], #> PARAMETER["False northing",0, #> LENGTHUNIT["metre",1], #> ID["EPSG",8807]]], #> CS[Cartesian,2], #> AXIS["(E)",east, #> ORDER[1], #> LENGTHUNIT["metre",1]], #> AXIS["(N)",north, #> ORDER[2], #> LENGTHUNIT["metre",1]], #> USAGE[ #> SCOPE["Engineering survey, topographic mapping."], #> AREA["Between 132°W and 126°W, northern hemisphere between equator and 84°N, onshore and offshore. Canada - British Columbia (BC); NorthW Territories (NWT); Yukon. United States (USA) - Alaska (AK)."], #> BBOX[0,-132,84,-126]], #> ID["EPSG",32609]]
st_crs2("+proj=utm +zone=9 +datum=WGS84 +units=m +no_defs")
#> Warning: Using PROJ.4 strings is deprecated with PROJ >= 6 (see #> https://www.r-spatial.org/r/2020/03/17/wkt.html).
#> Coordinate Reference System: #> User input: +proj=utm +zone=9 +datum=WGS84 +units=m +no_defs #> wkt: #> PROJCRS["unknown", #> BASEGEOGCRS["unknown", #> DATUM["World Geodetic System 1984", #> ELLIPSOID["WGS 84",6378137,298.257223563, #> LENGTHUNIT["metre",1]], #> ID["EPSG",6326]], #> PRIMEM["Greenwich",0, #> ANGLEUNIT["degree",0.0174532925199433], #> ID["EPSG",8901]]], #> CONVERSION["UTM zone 9N", #> METHOD["Transverse Mercator", #> ID["EPSG",9807]], #> PARAMETER["Latitude of natural origin",0, #> ANGLEUNIT["degree",0.0174532925199433], #> ID["EPSG",8801]], #> PARAMETER["Longitude of natural origin",-129, #> ANGLEUNIT["degree",0.0174532925199433], #> ID["EPSG",8802]], #> PARAMETER["Scale factor at natural origin",0.9996, #> SCALEUNIT["unity",1], #> ID["EPSG",8805]], #> PARAMETER["False easting",500000, #> LENGTHUNIT["metre",1], #> ID["EPSG",8806]], #> PARAMETER["False northing",0, #> LENGTHUNIT["metre",1], #> ID["EPSG",8807]], #> ID["EPSG",16009]], #> CS[Cartesian,2], #> AXIS["(E)",east, #> ORDER[1], #> LENGTHUNIT["metre",1, #> ID["EPSG",9001]]], #> AXIS["(N)",north, #> ORDER[2], #> LENGTHUNIT["metre",1, #> ID["EPSG",9001]]]]
st_crs2(raster::raster(raster_path)) # st_crs(raster) uses the PROJ.4 as input
#> Coordinate Reference System: #> User input: WGS 84 / UTM zone 32N #> wkt: #> PROJCRS["WGS 84 / UTM zone 32N", #> BASEGEOGCRS["WGS 84", #> DATUM["World Geodetic System 1984", #> ELLIPSOID["WGS 84",6378137,298.257223563, #> LENGTHUNIT["metre",1]]], #> PRIMEM["Greenwich",0, #> ANGLEUNIT["degree",0.0174532925199433]], #> ID["EPSG",4326]], #> CONVERSION["UTM zone 32N", #> METHOD["Transverse Mercator", #> ID["EPSG",9807]], #> PARAMETER["Latitude of natural origin",0, #> ANGLEUNIT["degree",0.0174532925199433], #> ID["EPSG",8801]], #> PARAMETER["Longitude of natural origin",9, #> ANGLEUNIT["degree",0.0174532925199433], #> ID["EPSG",8802]], #> PARAMETER["Scale factor at natural origin",0.9996, #> SCALEUNIT["unity",1], #> ID["EPSG",8805]], #> PARAMETER["False easting",500000, #> LENGTHUNIT["metre",1], #> ID["EPSG",8806]], #> PARAMETER["False northing",0, #> LENGTHUNIT["metre",1], #> ID["EPSG",8807]]], #> CS[Cartesian,2], #> AXIS["(E)",east, #> ORDER[1], #> LENGTHUNIT["metre",1]], #> AXIS["(N)",north, #> ORDER[2], #> LENGTHUNIT["metre",1]], #> USAGE[ #> SCOPE["Engineering survey, topographic mapping."], #> AREA["Between 6°E and 12°E, northern hemisphere between equator and 84°N, onshore and offshore. Algeria. Austria. Cameroon. Denmark. Equatorial Guinea. France. Gabon. Germany. Italy. Libya. Liechtenstein. Monaco. Netherlands. Niger. Nigeria. Norway. Sao Tome and Principe. Svalbard. Sweden. Switzerland. Tunisia. Vatican City State."], #> BBOX[0,6,84,12]], #> ID["EPSG",32632]]
# }