r-lidar / lidR

Airborne LiDAR data manipulation and visualisation for forestry application
https://CRAN.R-project.org/package=lidR
GNU General Public License v3.0
582 stars 130 forks source link

Different Point Data Format in the same catalog #722

Closed ouroukhai closed 10 months ago

ouroukhai commented 10 months ago

Hello,

I work on a catalog with different Point data formats. After running a height normalization algorithm, I had this message: "Different files have different Point Data Format ID and are incompatible. Some attribute may have been discarded or zeroed"

By examining the files individually, I noticed that the different file formats refer to 1 and 3. By investigating a bit more, I came across that:

1: Standard point data, XYZ + intensity 3: Standard point data, XYZ + intensity + RGB color (Please correct me if I am wrong)

By further examining the files, I verified that files with code 3 had RGB, while files with code 1 hadn't. However, the attributes (RGB in this case) do not seem to disappear or be set to 0.

My question comes down to if I can ignore this warning for this specific case, i.e. even though some files do not have RGB, it does not really matter because the RGB attributes will be contained nevertheless.

If what I claim above is correct, can I find somewhere the cases where I would miss attributes by handling catalogs with different point data formats?

Thank you very much for your time. Best regards...

Jean-Romain commented 10 months ago

Your catalog is made of files of different formats. If you are processing by file without buffer, this changes nothing. However, if you process by chunk of arbitrary size of by file with a buffer you will read points from different files.

With a buffer for example, the central file may be format 1 and all its neighbor files may be format 1 too but 1 neighbor file may be format 3. In this case, the points are read as format 1 and RGB from the file in format 3 will be zeroed in the buffer. Similarly, you may read a central file in format 3 with neighbor files in format 1. In this case the point cloud is read as format 3. The points from central tiles have RGB but the points in the buffer don't (RGB = 0).

When writing the files on disk, the buffer is removed so it changes nothing if you are processing by files. However, if you are processing by chunk you may end with weird files in format 3 but half the point have RGB = 0. Or file format 1 where you lose the original RGB information.

Not sure if my explanations are clear. Do not hesitate to ask for clarification