getCRS {enmSdmX}R Documentation

WKT string for a named coordinate reference system or a spatial object

Description

Retrieve the Well-Known text string (WKT2) for a coordinate reference system (CRS) by name or from a spatial object. The most common usage of the function is to return the WKT2 string using an easy-to-remember name. For example, getCRS('wgs84') returns the WKT2 string for the WGS84 datum. To get a table of strings, just use getCRS().

Usage

getCRS(x = NULL, nice = FALSE, warn = TRUE)

Arguments

x

This can be any of:

  • Name of CRS: Each CRS has one "long" name and at least one "short" name, which appear in the table returned by getCRS(). You can use the "long" name of the CRS, or either of the two "short" names. Spaces, case, and dashes are ignored, but to make the codes more memorable, they are shown as having them.

  • NULL (default): This returns a table of projections with their "long" and "short" names (nearly the same as data(crss)).

  • An object of class SpatVector, SpatRaster, or sf. If this is a "Spat" object, then a character vector with the CRS in WKT form is returned. If a sf is supplied, then a crs object is returned in WKT format.

nice

If TRUE, then print the CRS in a formatted manner and return it invisibly. Default is FALSE.

warn

If TRUE (default), then print a warning if the name of the CRS cannot be found.

Value

A string representing WKT2 (well-known text) object or a data.frame.

Examples


# view table of available CRSs
getCRS()

# get specific WKT2 strings
getCRS('WGS84')
getCRS('Mollweide')
getCRS('WorldClim')

# WKT2 strings nice for your eyes
getCRS('WGS84', TRUE)

data(mad0)
getCRS(mad0)


[Package enmSdmX version 1.1.2 Index]