Learn R Programming

PROJ (version 0.4.5)

proj_crs_text: Generate a projection string.

Description

Input any accepted format of 'PROJ' coordinate reference system specification. Return value is a string in the requested format.

Usage

proj_crs_text(source, format = 0L)

Value

character string in requested format

Arguments

source

input projection specification one of ('PROJ4', 'WKT2', 'EPSG', 'PROJJSON', ... see the library documentation link in Details)

format

integer, 0 for 'WKT', 1 for 'PROJ', 2 for 'PROJJSON'

warning Note that a PROJ string is not a full specification, in particular this means that a string like "+proj=laea" cannot be converted to full WKT, because it is technically a transformation step not a crs. To get the full WKT form use a string like "+proj=laea +type=crs".

Details

This function requires PROJ version 6.0 or higher to be useful. If not, this function simply returns 'NA'.

See the library documentation for details on input and output formats.

Examples

Run this code
if (ok_proj6()) {
cat(proj_crs_text("OGC:CRS84", format = 0L))
proj_crs_text("OGC:CRS84", format = 1L)
south55 <- "+proj=utm +zone=55 +south +ellps=GRS80 +units=m +no_defs +type=crs"
proj_crs_text(proj_crs_text(south55), 1L)
}

Run the code above in your browser using DataLab