crds <- matrix(c(179, -179, -179, 179, 50, 50, 52, 52), ncol=2)
SL <- SpatialLines(list(Slines(list(Sline(crds, CRS("+proj=latlong"))))))
bbox(SL)
SLr <- recenter(SL)
bbox(SLr)
rcrds <- rbind(crds, crds[1,])
SR <- SpatialRings(list(Srings(list(Sring(rcrds, CRS("+proj=latlong"))), ID="r1")))
bbox(SR)
SRr <- recenter(SR)
bbox(SRr)
opar <- par(mfrow=c(1,2))
plot(SR)
plot(SRr)
par(opar)
crds <- matrix(c(-1, 1, 1, -1, 50, 50, 52, 52), ncol=2)
SL <- SpatialLines(list(Slines(list(Sline(crds, CRS("+proj=latlong"))))))
bbox(SL)
SLr <- recenter(SL)
bbox(SLr)
rcrds <- rbind(crds, crds[1,])
SR <- SpatialRings(list(Srings(list(Sring(rcrds, CRS("+proj=latlong"))), ID="r1")))
bbox(SR)
SRr <- recenter(SR)
bbox(SRr)
opar <- par(mfrow=c(1,2))
plot(SR)
plot(SRr)
par(opar)
Run the code above in your browser using DataCamp Workspace