View source: R/reextent_function.R
reextent | R Documentation |
This function shifts the extent of a raster from -180:180 to 0:360 and vice versa
reextent(ras, method)
ras |
Raster object to shift the extent |
method |
Numerical value to indicate direction of extent change. '1' shifts from -180:180 to 0:360. '2' shifts from 0:360 to -180:180. |
Shifted raster
### Create Test data r <- raster::raster(vals = c(rep(1:360,length.out=64800/2),rep(1:360,length.out=64800/2))) plot(r) # convert r from -180:180 to 0:360 out <- reextent(r, method = 1) plot(out) # convert back to -180:180 out2 <- reextent(out, method = 2) plot(out2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.