This is an extension of this question: How to remove buffer from DTM TIFF using Catalog

When I generate a DTM using the following code (or any of the code provided in the above linked question), I get a DTM raster that is not the same size as the input las file.

ctg = readLAScatalog("D:/lasfiles/", recursive = TRUE)
st_crs(ctg) = 3011

opt_output_files(ctg) <- "D:/lasfiles/DTM/*"

dtm <- rasterize_terrain(ctg, res = 1, tin())

The image shows a DTM raster that extends beyond the extent of the LAS points shown as pink. Both input LAS file and output raster have the same projection.

Any ideas as to why this would happen?

Image showing raster does not have same extent as input LAS file


  • added a new image to show the top and bottom of raster is larger than the LAS file extent
  • Turns out I forgot that I re-projected the LAS files individually. I will try to merge all the original files into a massive LAS file, re-project, re-tile

1 Answer 1


It indeed extends beyond the hull of the points but does not extend beyond the bounding box of the point. lidR works based on the bounding boxes of the files not based on the actual shape of the point cloud, this would be too complex and too heavy in the general case.

Thus, your output is correct. Your dataset is not properly tiled, and your point cloud shape does not match its bounding box. There is nothing straightforward you can do. Your catalog has overlaps and when you use readLAScatalog() you have a warning about overlapping tiles. Here you found a side effect of improperly tiled dataset.

I can't see any straightforward options. If the point cloud shape does not match the bounding box, you must compute the hull of each file in order to be able to mask some part. You could retile your catalog with catalog_retile()

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.