For some resources the raster files show slight differences in their spatial extent (usually beyond 5 decimal points). {terra} seems to be able to stack rasters if the cell numbers are identical and the difference in extent is not larger that 3.6° (see code snippet below). The difference {terra} allows rasters to differ in extent is quite significant, but not of further concern here. The issue is actually with {sf} which compares geometries to a certain level of precision which lead to errrs in .read_raster_source(). To match rasters correctly as overlapping, .read_raster_source() should apply a precision roundtrip before comparing the bounding boxes. A reasonable thresholds seems to be 5 decimal points, irrespective of the units of the CRS (maybe even lower).
This example shows that {terra} still merges raster event if the differences in extent are quite substantial
For some resources the raster files show slight differences in their spatial extent (usually beyond 5 decimal points).
{terra}
seems to be able to stack rasters if the cell numbers are identical and the difference in extent is not larger that 3.6° (see code snippet below). The difference{terra}
allows rasters to differ in extent is quite significant, but not of further concern here. The issue is actually with{sf}
which compares geometries to a certain level of precision which lead to errrs in.read_raster_source()
. To match rasters correctly as overlapping,.read_raster_source()
should apply a precision roundtrip before comparing the bounding boxes. A reasonable thresholds seems to be 5 decimal points, irrespective of the units of the CRS (maybe even lower).This example shows that
{terra}
still merges raster event if the differences in extent are quite substantialCreated on 2023-12-04 with reprex v2.0.2