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
601 stars 131 forks source link

Problems in exporting LAS file after intensity normalization. #685

Closed rorai-neto closed 1 year ago

rorai-neto commented 1 year ago

I am performing intensities normalization in my LiDAR data. On the first attempt to perform the track_sensor, an error message appears

"Error: After keeping only first and last returns of multiple pulses returns, 16 pulses still have more than 2 points. This dataset is corrupted and gpstime is likely to be invalid. In addition: Warning message: There were 12 duplicated points. They were removed for processing. "

So I fixed it using the following:

sectorder(las@data, gpstime, UserData, Z)
las@data[, `:=`(ReturnNumber = 1:.N, NumberOfReturns = .N), by = .(gpstime, UserData)]
las = las_update(las)

Afterwards, I can run the track_sensor, calculate the range and normalize the intensities.

However, when i try to export the point cloud after the normalization, the following error message appears:

"Error: Invalid data: ReturnNumber is not an unsigned integer on 3 bits"

What does this message mean, and is it possible to fix this error?

Thanks in advance for the help. All the best.

Jean-Romain commented 1 year ago

In

las@data[, `:=`(ReturnNumber = 1:.N, NumberOfReturns = .N), by = .(gpstime, UserData)]

You have one or several groups with more than 7 points. Thus you are assigning a return number > 7 which is not possible in a LAS file version < 1.4. I can't say more without a reproductible example. The dataset was originally invalid, renumbering the point was unlikely to fix the problem. You must identify your problem first.

wiesehahn commented 1 year ago

thats good to know I was'nt aware of this 3bit encoding

rorai-neto commented 1 year ago

In

las@data[, `:=`(ReturnNumber = 1:.N, NumberOfReturns = .N), by = .(gpstime, UserData)]

You have one or several groups with more than 7 points. Thus you are assigning a return number > 7 which is not possible in a LAS file version < 1.4. I can't say more without a reproductible example. The dataset was originally invalid, renumbering the point was unlikely to fix the problem. You must identify your problem first.

Thank you very much for your reply. I used the las_check and I have the follow message

Checking the data

If it helps, attached is the link to download the point cloud tile. https://www.dropbox.com/sh/0dtvj0iice4i7h2/AABJSs1YT--zH2ccaLQ7gtIYa?dl=0

Thank you very much.

Jean-Romain commented 1 year ago

I see

✗ 2182 pulses (points with the same gpstime) have points with identical ReturnNumber

However it does not use UserData for multibeam laser. So you may have less than this number if your sampling device is multibeam

rorai-neto commented 1 year ago

I see

✗ 2182 pulses (points with the same gpstime) have points with identical ReturnNumber

However it does not use UserData for multibeam laser. So you may have less than this number if your sampling device is multibeam

I see. Thank you very much. Do you know how can i fix this to proceed with the intensities normalization? All the best.