1\name{is.projected}
2\alias{is.projected}
3\alias{proj4string}
4\alias{proj4string<-}
5\alias{is.projected,Spatial-method}
6\alias{proj4string,Spatial-method}
7\alias{wkt}
8\alias{wkt,Spatial-method}
9\alias{proj4string<-,Spatial,CRS-method}
10\alias{proj4string<-,Spatial,character-method}
11\alias{get_ll_warn}
12\alias{get_ll_TOL}
13\alias{set_ll_warn}
14\alias{set_ll_TOL}
15\alias{get_ReplCRS_warn}
16\alias{set_ReplCRS_warn}
17
18\title{ Sets or retrieves projection attributes on classes extending
19SpatialData }
20\description{ Sets or retrieves projection attributes on classes extending
21SpatialData; set or retrieve option value for error or warning on exceedance of geographical coordinate range, set or retrieve option value for exceedance tolerance of geographical coordinate range. Note that only \dQuote{+proj=longlat +ellps=WGS84} is accepted for geographical coordinates, which must be ordered (eastings, northings); the \dQuote{+ellps=} definition must be given (or expanded internally from a given \dQuote{+datum=} value) for recent versions of the PROJ library, and should be set to an appropriate value.
22
23From release 6 of the PROJ library, when used in building \pkg{rgdal} with GDAL >= 3, the \code{+datum=} key in the Proj.4 string CRS representation is deprecated, and the \code{+towgs84=} and \code{+nadgrids=} keys may be deprecated soon. For this reason, \pkg{sp}, \pkg{rgdal} and \pkg{sf} are starting to use WKT2 (2019) string representations. In \pkg{sp}, the \code{"CRS"} object in itself remains unchanged, but the content of its \code{"projargs"} slot may be degraded. To work around the degradation, a \code{comment} is added around the \code{"CRS"} object containing a WKT2 (2019) string when \pkg{rgdal} is available and built with PROJ >= 6 and GDAL >=3. The \code{wkt()} accessor function returns the WKT2 (2019) string comment belonging to the \code{"CRS"} object.
24
25}
26\usage{
27is.projected(obj)
28proj4string(obj)
29proj4string(obj) <- value
30wkt(obj)
31get_ll_warn()
32get_ll_TOL()
33get_ReplCRS_warn()
34set_ll_warn(value)
35set_ll_TOL(value)
36set_ReplCRS_warn(value)
37}
38\arguments{
39  \item{obj}{An object of class or extending \link{Spatial-class}}
40  \item{value}{For \code{proj4string} CRS object, containing a valid proj4 string; attempts to assign an object containing \dQuote{longlat} to data extending beyond longitude [-180, 360] or lattitude [-90, 90] will be stopped. For \code{set_ll_warn} a single logical value, if FALSE (default) error on range exceedance, if TRUE, warning. For \code{set_ll_TOL} the value of the power of \code{.Machine$double.eps} (default 0.25) to use as tolerance in testing range exceedance. \code{set_ReplCRS_warn} may be used to turn off warnings issued when changing object CRS with the \code{proj4string} replacement method (by setting \code{value=FALSE}).}
41}
42
43\value{ \code{is.projected} returns a logical that may be \code{NA};
44\code{proj4string} returns a character vector of length 1.}
45
46\details{ proj4 strings are operative through CRAN package rgdal. For strings defined as \dQuote{longlat}, the minimum longitude should be -180, the maximum longitude 360, the minimum latitude -90, and the maximum latitude 90. Note that the \code{proj4string} replacement method does not project spatial data - for this use \code{spTransform} methods in the rgdal package.}
47
48\author{
49  Edzer Pebesma, \email{edzer.pebesma@uni-muenster.de}
50}
51
52\seealso{ \link{CRS} }
53
54\examples{
55o <- new("Spatial")
56proj4string(o) <- CRS("+init=epsg:27700")
57if (!is.null(comment(slot(o, "proj4string")))) {
58  cat(strsplit(wkt(o), "\\n")[[1]], sep="\n")
59  cat(strsplit(wkt(slot(o, "proj4string")), "\\n")[[1]], sep="\n")
60}
61is.projected(CRS("+proj=longlat"))
62is.projected(CRS("+proj=geocent"))
63is.projected(CRS("+proj=geocent +units=km"))
64
65}
66
67\keyword{spatial}
68