- Is 'PROJ library >= 6' available
- Generate a projection string.
- Transform a set of coordinates with 'PROJ'
- Report PROJ library version
- xymap data for testing

Test for availability of 'PROJ' system library version 6 or higher.

`ok_proj6()`

On unix-alikes, this function is run in `.onLoad()`

to check that version 6 functionality is
available. On Windows, the load process sets the data file location with the version 6 API, and that
is used as a test instead.

If 'PROJ' library version 6 is not available, the package still compiles and installs but is not functional.

The lack of function can be simulated by setting
`options(reproj.mock.noproj6 = TRUE)`

, designed for use with the reproj package.

logical, `TRUE`

if the system library 'PROJ >= 6'

`ok_proj6()`

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

`proj_crs_text(source, format = 0L)`

`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' |

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.

character string in requested format

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".

```
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)
}
```

A raw interface to 'proj_trans' in 'PROJ => 6', if it is available.

`proj_trans(x, target, ..., source = NULL, z_ = NULL, t_ = NULL)`

`x` |
input coordinates (x,y, list or matrix see |

`target` |
projection for output coordinates |

`...` |
ignored |

`source` |
projection of input coordinates (must be named i.e. 'source = "<some proj string"' can't be used in positional form) |

`z_` |
optional z coordinate vector |

`t_` |
optional t coordinate vector |

Input 'x' is assumed to be 2-columns of "x", then "y" coordinates. If "z" or
"t" is required pass these in as named vectors with "z_" and "t_". For simplifying reasons
`z_`

and `t_`

must always match the length of `x`

`y`

. Both default to 0, and are automatically
recycled to the number of rows in `x`

.

Values that are detected out of bounds by library PROJ are allowed, we return `Inf`

in this
case, rather than the error "tolerance condition error".

list of transformed coordinates, with 4- or 2-elements `x_`

, `y_`

, `z_`

, `t_`

see the PROJ library documentation for details on the underlying functionality

```
if (ok_proj6()) {
proj_trans(cbind(147, -42), "+proj=laea", source = "OGC:CRS84")
proj_trans(cbind(147, -42), z_ = -2, "+proj=laea", source = "OGC:CRS84")
proj_trans(cbind(147, -42), z_ = -2, t_ = 1, "+proj=laea", source = "OGC:CRS84")
}
```

This function returns NA if PROJ lib is not available.

`proj_version()`

character string (major.minor.patch)

`proj_version()`

A copy of the xymap data set from the quadmesh package.

A matrix of longitude/latitude values of the world coastline.