CRS object generic methods

wk_crs_proj_definition(crs, proj_version = NULL, verbose = FALSE)

wk_crs_projjson(crs)

# S3 method for `NULL`
wk_crs_proj_definition(crs, proj_version = NULL, verbose = FALSE)

# S3 method for wk_crs_inherit
wk_crs_proj_definition(crs, proj_version = NULL, verbose = FALSE)

# S3 method for character
wk_crs_proj_definition(crs, proj_version = NULL, verbose = FALSE)

# S3 method for double
wk_crs_proj_definition(crs, proj_version = NULL, verbose = FALSE)

# S3 method for integer
wk_crs_proj_definition(crs, proj_version = NULL, verbose = FALSE)

Arguments

crs

An arbitrary R object

proj_version

A package_version() of the PROJ version, or NULL if the PROJ version is unknown.

verbose

Use TRUE to request a more verbose version of the PROJ definition (e.g., PROJJSON). The default of FALSE should return the most compact version that completely describes the CRS. An authority:code string (e.g., "OGC:CRS84") is the recommended way to represent a CRS when verbose is FALSE, if possible, falling back to the most recent version of WKT2 or PROJJSON.

Value

  • wk_crs_proj_definition() Returns a string used to represent the CRS in PROJ. For recent PROJ version you'll want to return PROJJSON; however you should check proj_version if you want this to work with older versions of PROJ.

  • wk_crs_projjson() Returns a PROJJSON string or NA_character_ if this representation is unknown or can't be calculated.

Examples

wk_crs_proj_definition("EPSG:4326")
#> [1] "EPSG:4326"