1

How do I resample the 0.7 m LiDAR to 10 m DEM in R?

What are the basic rules for checking the consistency?

Andre Silva
  • 10,259
  • 12
  • 54
  • 106

1 Answers1

2

One way to do is using resample from raster package. Two methods are available: 'bilinear' and 'nearest neighbour' (pick nearest neighbour, as suggested in Resample binary raster to give *proportion* within new cell window).

See the example code from raster package documentation:

# this is a sample code which you need to adapt to your specific case.
r <- raster(nrow=3, ncol=3)
r[] <- 1:ncell(r)
s <- raster(nrow=10, ncol=10)
s <- resample(r, s, method='bilinear')
#par(mfrow=c(1,2))

In the example above, r is your 0.7 m LiDAR DEM, and s is the raster object to be resampled. Make sure s has the following parameters equal to r:

  • origin (see xmn, ymn parameters). OR
  • ext (extent, aka bounding box). If you want r and s to have the same extent (i.e., to match in their outside borders), you need to resample to a cell size multiple from 0.7 m. For example, 9.8 m. AND
  • crs (Coordinate Reference System).

Check the raster function to know how to set above parameters in s.

Andre Silva
  • 10,259
  • 12
  • 54
  • 106
  • The question is about aggregation, not about interpolation. – Mike T Jan 22 '19 at 01:05
  • 1
    @MikeT, the question is about resampling, which is a method of interpolation (one interpolates within the new cell, from the previous multiple cells; but aggregation is correct as well). – Andre Silva Jan 22 '19 at 01:08
  • 1
    A bilinear method is good for interpolation (i.e. constructing new data points within the range of a discrete set of known data points). However, bilinear is a poor choice when aggregating to a coarser resolution. See more details here and here. – Mike T Jan 22 '19 at 01:20
  • raster::aggregate looks like a promising approach (which I haven't used). However, it requires an integer factor, whereas 0.7 is not a factor of 10... – Mike T Jan 22 '19 at 01:44