Debian Codegraph @

man/recenter-methods.Rd

raw
1 \name{recenter-methods}
2 \docType{methods}
3 \alias{recenter-methods}
4 \alias{recenter}
5 \alias{recenter,SpatialPolygons-method}
6 \alias{recenter,Polygons-method}
7 \alias{recenter,Polygon-method}
8 \alias{recenter,SpatialLines-method}
9 \alias{recenter,Lines-method}
10 \alias{recenter,Line-method}
11 \title{Methods for Function recenter in Package `sp'}
12 \description{
13 Methods for function \code{recenter} in package \pkg{sp} to shift or re-center geographical coordinates for a Pacific view. All longitudes < 0 are added to 360, to avoid for instance parts of Alaska being represented on the far left and right of a plot because they have values straddling 180 degrees. In general, using a projected coordinate reference system is to be preferred, but this method permits a geographical coordinate reference system to be used. This idea was suggested by Greg Snow, and corresponds to the two world representations in the \pkg{maps} package.
14 }
15 \section{Methods}{
16 \describe{
17
18 \item{obj = "SpatialPolygons"}{recenter a SpatialPolygons object}
19
20 \item{obj = "Polygons"}{recenter a Polygons object }
21
22 \item{obj = "Polygon"}{recenter an Polygon object }
23
24 \item{obj = "SpatialLines"}{recenter a SpatialLines object }
25
26 \item{obj = "Lines"}{recenter a Lines object }
27
28 \item{obj = "Line"}{recenter an Line object }
29 }}
30
31 \examples{
32 crds <- matrix(c(179, -179, -179, 179, 50, 50, 52, 52), ncol=2)
33 SL <- SpatialLines(list(Lines(list(Line(crds)), "1")),
34 CRS("+proj=longlat +ellps=WGS84"))
35 bbox(SL)
36 SLr <- recenter(SL)
37 bbox(SLr)
38 rcrds <- rbind(crds, crds[1,])
39 SpP <- SpatialPolygons(list(Polygons(list(Polygon(rcrds)), ID="r1")),
40 proj4string=CRS("+proj=longlat +ellps=WGS84"))
41 bbox(SpP)
42 SpPr <- recenter(SpP)
43 bbox(SpPr)
44 opar <- par(mfrow=c(1,2))
45 plot(SpP)
46 plot(SpPr)
47 par(opar)
48 crds <- matrix(c(-1, 1, 1, -1, 50, 50, 52, 52), ncol=2)
49 SL <- SpatialLines(list(Lines(list(Line(crds)), "1")),
50 CRS("+proj=longlat +ellps=WGS84"))
51 bbox(SL)
52 SLr <- recenter(SL)
53 bbox(SLr)
54 rcrds <- rbind(crds, crds[1,])
55 SpP <- SpatialPolygons(list(Polygons(list(Polygon(rcrds)), ID="r1")),
56 proj4string=CRS("+proj=longlat +ellps=WGS84"))
57 bbox(SpP)
58 SpPr <- recenter(SpP)
59 bbox(SpPr)
60 opar <- par(mfrow=c(1,2))
61 plot(SpP)
62 plot(SpPr)
63 par(opar)
64 }
65
66 \keyword{methods}
67