clip_roi vs. filter keep_xy #544
-
I have a large catalog just tried to read part of it via # attempt1
las = clip_roi(catalog, bbox)
# attempt2
las = readLAS(catalog, filter = paste("-keep_xy", bbox$xmin, bbox$ymin, bbox$xmax, bbox$ymax)) I expected attempt 2 to be faster but instead I aborted it after 5 minutes while attempt 1 was ready within 7 seconds. Why is that? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
I think the behavior is legit and expected but you did not provide enough details to be 100% sure of my answer. Please show |
Beta Was this translation helpful? Give feedback.
-
There is a lot to say here. First of all you cannot expect the second query to be faster than the first one for the simple reason that internally, lidR already does what is the best and the most efficient. So in the best case you can only be as fast as lidR.
This is correct. But the spatial index aware way to make a rectangular query is
Probably better but not as fast as expected. As a conclusion
As far as I know you can't. This is not part of the documentation of |
Beta Was this translation helpful? Give feedback.
There is a lot to say here.
First of all you cannot expect the second query to be faster than the first one for the simple reason that internally, lidR already does what is the best and the most efficient. So in the best case you can only be as fast as lidR.
clip()
analyses the bounding box of the query and removes all the files that are not overlapped by the bounding box. In your case it corresponds to maybe one or two files only I guess. Let say two files. Theclip()
query is consequently performed in 2 files only. You performed the query in 50000 files!This is correct. Bu…