This is a convenience temporary function which returns the WKT
representation of a CRS, using sf::st_as_text()
in case PROJ < 3,
rgdal::CRS()
otherwise.
This has the advantage to perform precise transformations with PROJ >=3,
and to avoid conversion errors
(see here).
This function will be deleted whenever sf
will manage WKT2.
st_as_text_2(x, pretty = FALSE)
x | object of class |
---|---|
pretty | logical; if TRUE, print human-readable well-known-text representation of a coordinate reference system |
Well-known Text representation of simple feature geometry or coordinate reference system
#> [1] "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\"]]"