Re: [R-sig-Geo] Same mask for two rasters, but obtaining different extents in R

2017-03-16 Thread Ben Tupper
Hi, In the short term you could use raster::alignExtent() to get align bio5 to the the extent of lg5. I would also inspect the source of your data and compare it to your locally stored copy of it. If they are different then it would be worthwhile to review the steps you used to download,

Re: [R-sig-Geo] Same mask for two rasters, but obtaining different extents in R

2017-03-16 Thread Vijay Ramesh via R-sig-Geo
I re-checked the original extent and here it is: This is data obtained from WorldClim. > bio5 class : RasterLayer dimensions : 3600, 8640, 31104000 (nrow, ncol, ncell) resolution : 0.0417, 0.0417 (x, y) extent : -180, 180, -60, *90.1 * (xmin, xmax, ymin, ymax) #This

Re: [R-sig-Geo] Same mask for two rasters, but obtaining different extents in R

2017-03-15 Thread Sarah Goslee
The most likely explanation seems to me that the rasters were not aligned before cropping, so they are not aligned after cropping. Have you checked the original extent and resolution? Sarah On Tue, Mar 14, 2017 at 5:31 PM, Vijay Ramesh via R-sig-Geo wrote: > I loaded a

Re: [R-sig-Geo] Same mask for two rasters, but obtaining different extents in R

2017-03-15 Thread Ben Tupper
Hi, Might you show us what bio5 and lg5 look like before you do the masking? Cheers, Ben > On Mar 14, 2017, at 5:31 PM, Vijay Ramesh via R-sig-Geo > wrote: > > I loaded a shapefile in R, and cropped and masked it with the same mask, > but I get different extents.

[R-sig-Geo] Same mask for two rasters, but obtaining different extents in R

2017-03-15 Thread Vijay Ramesh via R-sig-Geo
I loaded a shapefile in R, and cropped and masked it with the same mask, but I get different extents. Any suggestions? Code below: library(raster) library(rgdal) library(GISTools) library(sp) library(maptools) ##Loading the first mask Mask <-