0

How can I crop right raster to extent of left raster below? I used:

cr <- crop(right, extent(left),snap="out") 
fr <- rasterize(left, cr) 
r<- mask(x=cr, mask=fr)

but did not succeed.

Thanks for suggesting a work around.

enter image description here

code123
  • 2,082
  • 4
  • 30
  • 53
  • See here: http://gis.stackexchange.com/questions/180743/crop-raster-based-on-another-raster-r –  Feb 16 '16 at 03:11
  • i believe you can just take the extent of your left raster extent(left) and use it in the crop function : crop(right, extent(left)) – maRtin Feb 21 '16 at 12:12

1 Answers1

-1

I got the answer by using cr <- crop(right, extent(-141.01807 , -52.61941, 41.68144, 60), snap="out") but I guess there should be a clever way to use the extent of the raster itself and not of the shapefile via visual inspection

enter image description here

code123
  • 2,082
  • 4
  • 30
  • 53
  • See here: http://gis.stackexchange.com/questions/180743/crop-raster-based-on-another-raster-r –  Feb 16 '16 at 03:11