[R-sig-Geo] From NCEAS: Notice discrepancy in raster subimages clipped with same extent -

Rick Reeves reeves at nceas.ucsb.edu
Wed Apr 27 02:49:09 CEST 2011


Hi Robert:

Apologize for not posting this yet on rSigGeo, but I am under
a bit of time pressure:

When clipping two images with the same extent object:

Browse[2]> eTestAreaExtent
class       : Extent
xmin        : -135.2
xmax        : -100.2
ymin        : 59.998
ymax        : 60.002

The resulting images have different extents:

rEdgeRegionCDEM <- crop(inputCDEMRaster, eTestAreaExtent)
rEdgeRegionAsterCgiar <- crop(inputAsterCgiarRaster, eTestAreaExtent)

Browse[2]> extent(rEdgeRegionCDEM)
class       : Extent
xmin        : -135.1996
xmax        : -100.2002
ymin        : 59.99808
ymax        : 60.00224
Browse[2]> extent(rEdgeRegionAsterCgiar)
class       : Extent
xmin        : -135.1998
xmax        : -100.2003
ymin        : 59.99772
ymax        : 60.00189

..As a result, the command:

rDelta <- rEdgeRegionAsterCgiar - rEdgeRegionCDEM

results in:

Error in compare(e1, e2, extent = FALSE, rowcol = FALSE, prj = TRUE, res 
= TRUE,  :
   different origin

if I add the 'hack':

extent(rEdgeRegionCDEM) <- extent(rEdgeRegionAsterCgiar)

Then the subtraction operation works. But I doubt the true
absolute geographic alignment of the two images.

Any insights?

thanks,
Rick Reeves
NCEAS



Using raster package on:

platform       x86_64-pc-linux-gnu
arch           x86_64
os             linux-gnu
system         x86_64, linux-gnu
status
major          2
minor          13.0
year           2011
month          04
day            13
svn rev        55427
language       R
version.string R version 2.13.0 (2011-04-13)



More information about the R-sig-Geo mailing list