Closed ilCosmico closed 9 years ago
Thanks for the report. Hope that the fix complete and that I didn't overlooked something.
It seems quite good, but now it gives the following error:
The final error message is: "Reading point with index 2155617 of 2155617 total points" So I suppose it simply has reached the end of file... perhaps you could add a check like this:
What do you think?
This library is only a C# port of https://github.com/LASzip/LASzip and I'm trying to keep it as close as possible to the original. The idea of the originals API (which I'm only using) is: You have to check the results of laszip_get_point_count(out long count) and laszip_get_number_of_point(out long npoints) to determine, if you can read another point.
I have to admit, I would use a completely different API, which would be more on the StreamReader or BinaryReader API, if I were the maintainer (Martin Isenburg). But that is a completely different matter and would be a completely different library.
Ok, clear... thank you for the explanation and for the quick fix of course!
Great Job!
Hello,
I tried to load different LAZ files but I always get a NullReference exception.
Here below my code snippet for the reading:
List points = new List();
laszip.net.laszip_dll dll = new laszip.net.laszip_dll();
bool is_compressed = true;
dll.laszip_open_reader(fileName, ref is_compressed);
long expectedPointCount = (long)dll.header.number_of_point_records; double[] coordinates = new double[3]; int pointIndex = 0; while (dll.laszip_read_point() == 0) { pointIndex++;
dll.laszip_get_coordinates(coordinates); points.Add((float)coordinates[0]); points.Add((float)coordinates[1]); points.Add((float)coordinates[2]); } long pointCount; dll.laszip_get_point_count(out pointCount);
Here a link to download sample LAZ files: http://www.liblas.org/samples/