I have a catalog of just over 3000 LAZ files that I want to split into regions using clip_rectangle(). The total catalog size is 60GB. My PC has 64GB of RAM but I get an error that lidR is unable to create a 2.8GB vector when I try to create my subset.

Is the simple answer to get more RAM or is there a way to avoid this without having to add more RAM?

Here's my script:

ctg <- readLAScatalog("c:/noaa/utm/ground/")
#Make sure we plot the catalog so we can see where we want our clip regions
subset = clip_rectangle(ctg, 5550000, 2795000,570000,27972500)

enter image description here

1 Answer 1


clip_rectangle() extracts the region of interest as a single point-cloud. Here you are trying to load something like 100 files in R. For sure it failed and more RAM won't help. You are better to subset the LAScatalog with catalog_intersect().

subset = catalog_intersect(ctg, raster(extent(5550000, 2795000,570000,27972500)))
  • No matter what values I use for the extents, I get the following error: Error in slot(y, "proj4string") : no slot of name "proj4string" for this object of class "Extent"
    – Steve
    Mar 28, 2021 at 2:15
  • Try with a raster. I edited my anwser
    – JRR
    Mar 28, 2021 at 9:58
  • That seems to work although I get a warning message about Non Identical CRS
    – Steve
    Mar 28, 2021 at 21:25
  • Yes indeed but it does not really matter here
    – JRR
    Mar 28, 2021 at 22:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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