File: projection.Rd

package info (click to toggle)
r-cran-raster 3.6-31-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 3,300 kB
  • sloc: cpp: 2,367; ansic: 1,572; sh: 13; makefile: 2
file content (73 lines) | stat: -rw-r--r-- 1,680 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
\name{projection}

\alias{wkt}
\alias{wkt,ANY-method}
\alias{wkt,Raster-method}
\alias{crs}
\alias{crs,ANY-method}
\alias{crs<-}
\alias{projection}
\alias{projection<-}
\alias{proj4string}
\alias{proj4string,BasicRaster-method}
\alias{proj4string,CRS-method}
\alias{proj4string<-}
\alias{as.character,CRS-method}
\alias{is.na,CRS-method}
\alias{crs<-,BasicRaster-method}
\alias{crs<-,Spatial-method}


\title{ Get or set a coordinate reference system (projection) }

\description{
Get or set the coordinate reference system (CRS) of a Raster* object. 
}

\usage{

\S4method{crs}{ANY}(x, asText=FALSE, ...)
\S4method{wkt}{Raster}(obj)
crs(x, ...) <- value

projection(x, asText=TRUE)
projection(x) <- value
}

\arguments{
  \item{x}{Raster* or Spatial object }
  \item{obj}{Raster*, Spatial, or CRS object }
  \item{asText}{logical. If \code{TRUE}, the projection is returned as text. Otherwise a \code{\link[sp]{CRS-class}} object is returned}
   \item{...}{additional arguments. None implemented}
  \item{value}{\code{CRS} object or a character string describing a projection and datum in the PROJ.4 format }
}


\value{
Raster*, Spatial*, or character object
}

\note{
\code{crs} replaces earlier function \code{projection}.  
For compatibility with \code{sp} you can use \code{proj4string} instead of \code{crs}.
\code{wkt} returns the "well-known-text" representation of the crs.  
}

\seealso{ \code{\link[raster]{projectRaster}, \link[sp]{spTransform}}}

\details{ projections are done by with the PROJ library }



\examples{ 
r <- raster()
crs(r)
crs(r) <- "+proj=lcc +lat_1=48 +lat_2=33 +lon_0=-100 +datum=WGS84"
crs(r)
w <- wkt(r)
w
cat(w, "\n")
}

\keyword{ spatial }