Hi Jochen,
thanks for the explanation and the hints.
We went down this rabbit hole a little deeper.
So one issue we found is that using the laszip_update_inventory() is not working, because internally it is using U32 fields for the number of point records (see line 75, 76
U32 number_of_point_records;
U32 number_of_points_by_return[16];
in
https://github.com/LASzip/LASzip/blob/master/src/laszip_dll.cpp )
After changing these to U64 and recompiling (did the classic, forgot to copy the dll the first time ...) we are now able to write a laz file with ~5 Billion points
When we import this back using the laszip and printing the head of the laz file we get:
Header ................
SourceID : 1
Global Encoding: 0
GUID data1 : 0
GUID data2 : 0
GUID data3 : 0
Proj_ID_GUID : LAS Version : 1 . 4
Ident : LAS writer
Software : LASzip DLL 3.4 r3 (191111)
Day : 268
Year : 2023
HeadSize : 375
OffsetPData : 375
NumVarLR : 0
PointDataFormat: 7
PointDataFormat: Points + Reflectivity + color
PointDRL : 39
NumPoiRecords : 0
NumPoiRecordsR : 0
EXTNumPoiRecords : 4995044410
EXTNumPoiRecordsR : 0
Scales : 0.0005 0.0005 0.0005
Offset : 0 0 0
Min : 50.505 0.01 0.1
Max : 151.495 201.99 100.99
UD in H size : 0
UD a H size : 0
After importing (and exporting an E57 to be tripple sure), we found that we wrote nearly 5 billion points and were able to read them as well.
However testing this in CloudCompare, ReCap and LasTools, it always only displayed the integer overflow values ~705 million points.
Fully working example attached - perhaps you can give this a whirl.
Should be around 2GB of laz file (great compression ;) )
Output testcode on my machine:
Open Writer....
Write all points....
0% points to write: 5000000000
99% written points: 4994549361
how much data is left:5000000000-4995044410=4955590
Close writer....
What we are now woundering is: Are we doing something wrong since it is not working in the LasTools, where I'd expect it to work.
ReCap is using the LASzip as far as I know, so I could write them and ask them.
I think CloudCompares' LAS is based on PDAL, but no idea if they use LASzip or LAZperf.
Thanks a lot
Martin
PS: Are you coming to Intergeo in Berlin in October?