run <- FALSE
if (require(maps)) run <- TRUE
if (FALSE) {
if (run) {
world <- map("world", fill=TRUE, col="transparent", plot=FALSE)
worldSpP <- map2SpatialPolygons(world, world$names, CRS("+proj=longlat +ellps=WGS84"))
worldSpP <- worldSpP[-grep("Antarctica", row.names(worldSpP)),]
# incomplete polygons
worldSpP <- worldSpP[-grep("Ghana", row.names(worldSpP)),]
# self-intersection mouth of Volta
worldSpP <- worldSpP[-grep("UK:Great Britain", row.names(worldSpP)),]
# self-intersection Humber estuary
worldSpPr <- recenter(worldSpP)
plot(worldSpPr)
title("Pacific view without polygon splitting")
}
if (run) {
worldSpPnr <- nowrapRecenter(worldSpP)
plot(worldSpPnr)
title("Pacific view with polygon splitting")
}
}
if (!rgeosStatus()) run <- FALSE
if (run) {
crds <- matrix(c(-1, 1, 1, -1, 50, 50, 52, 52), ncol=2)
rcrds <- rbind(crds, crds[1,])
SR <- SpatialPolygons(list(Polygons(list(Polygon(rcrds)), ID="r1")),
proj4string=CRS("+proj=longlat +ellps=WGS84"))
bbox(SR)
}
if (run) {
SRr <- recenter(SR)
bbox(SRr)
}
if (run) {
SRnr <- nowrapRecenter(SR)
bbox(SRnr)
}
Run the code above in your browser using DataLab