shintadono / laszip.net Goto Github PK
View Code? Open in Web Editor NEWLAS/LAZ library for C#
License: GNU Lesser General Public License v2.1
LAS/LAZ library for C#
License: GNU Lesser General Public License v2.1
Hi,
I'm currently using the develop branch.
I'm trying to store the classification of the point as 99 (this is the requirement for some processing), but as result in the file is written classification 3.
I read about the fixed bug "Fixed issue #8.2, wrong bit-masks caused classifications greater 7 to be wrongly stored in class laszip_point (and subsequently written out wrongly).
"
I'm not a C# programmer, but I see in the source code of laszip_point.cs
:
public byte classification { get { return (byte)(classification_and_classification_flags & 31); } set { classification_and_classification_flags = (byte)((classification_and_classification_flags & 0xE0) | (value & 31)); } }
It is due to this, it's making some "modulus" of the input value?
How can I avoid this problem?
I can change in some way the source in my local copy of the laszip to make me write the value I want?
Thanks in advance
Francesco N. Vespucci
Attempting to read some 1.4 files results in this error.
"compressor 3 not supported (LASzip v2.2r0) ... "
Here is an example LAZ (1.4) file to reproduce the problem:
ftp://ftp.kymartian.ky.gov/kyaped/LAZ/N064E344.laz
Line 869 and 870 (method 'add_vlr') of laszp_dll.cs say this:
// remove existing VLRs with same record and user id
for (int i = (int)curHeader.number_of_variable_length_records - 1; i >= 0; i++)
I believe that the loop here is meant to count downward, and so i++ should be i--
I discovered this error while trying to add my own variable length records.
Thank you for your help.
i have been trying to use the following line to write a point rgb value but it doesnt seem to work.
lazWriter.point.rgb = lazReader.point.rgb;
do you have any suggestions on how to make this work
When I use the 'write las' class, I would like to write values for min and max intensity as follows:
intensity 0 65535
How can I do that? Is there a way to accomplish this?
thanks
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/
In a current project I am working with LARGE LAS files (multi gigabyte files). I had a problem when my source was a LAS file and i needed to seek to points at the end of the files. All the points read had wrong values in them.
The error is in LASreadPoint.cs at line 256.
It reads : instream.Seek(point_start + point_size * target, SeekOrigin.Begin);
due to the fact that point_size is of type uint the compiler incorrectly converts the whole calculation to a uint, but it should have converted it to a long. So I needed to change the line to read
instream.Seek(point_start + (long)point_size * target, SeekOrigin.Begin);
which fixed the problem and now it reads beyond the size limit of uint.
I should have made a branch and pull request but forgot to do so, so i am hoping shintadono can include this in his code.
how to get RGB integer of every point. thanks
Hi,
Nice framework for reading/writing laz files. Thanks for your efforts.
I am directly reading point data from a source which i can not guess the total number of points before writing them to laz file.
Thats why i can not set the "header.number_of_point_records" before writing points.
When i try to set it right before closing the writer after finishing my point iteration, it does not take it in account and the result file's header is not be updated.
Do you have any suggestion in order to update "header.number_of_point_records" after opening the writer ?
I would like to read the number of classifications in a LAS file without have to go through all the points. And even better, also get what classifications it is. Maybe it is already possible but I haven't found out how to do it?
If running LASinfo from LASTools, at the end you see something like this, there max classification is and at last, a list of the classifications in the file.
reporting minimum and maximum for all LAS point record entries ...
X -5666700 -5593800
Y 4825300 4870600
Z 18593 23050
intensity 2 241
return_number 1 4
number_of_returns 1 4
edge_of_flight_line 0 1
scan_direction_flag 0 1
classification 1 11
scan_angle_rank -15 23
user_data 0 0
point_source_ID 19904 19905
gps_time 128993.662014 164619.556113
overview over number of returns of given pulse: 391697 33254 4442 145 0 0 0
histogram of classification of points:
143525 unclassified (1)
285623 ground (2)
390 road surface (11)
Hi, I am trying to store RGB point values in a every point of a large point cloud using the writer. I verified that the rgb values are in the point but when I read the point back the RGB values are zero. I tried both 8 and 16 bit rgb values and with the classification value at 2 as touched upon in issue #9 . What I do in the code to save rgb is the following. p.R, p.G, p.B are 8-bit RGB values in bytes respectively:
laszip_point point = new laszip_point();
point.rgb[0] = Convert.ToUInt16(p.R * 256);
point.rgb[1] = Convert.ToUInt16(p.G * 256);
point.rgb[2] = Convert.ToUInt16(p.B * 256);
var err = m_LasWriter.laszip_set_point(point);
err = m_LasWriter.laszip_write_point();
Hi @shintadono, first of all thank you very much for this great library.
I have a question about this, are there any plans to support POINT14 and RGBNIR14 items from compressed LAZ files (v1.4).
Thanks in advance
In file laszip_dll.cs, Line 176 ...
Array.Copy(Encoding.ASCII.GetBytes(string.Format("LASzip DLL {0}.{1} r{2} ({3})", LASzip.VERSION_MAJOR, LASzip.VERSION_MINOR, LASzip.VERSION_REVISION, LASzip.VERSION_BUILD_DATE)), header.generating_software, 32);
... generates a first chance exception of type 'System.ArgumentException' occurred in mscorlib.dll.
https://msdn.microsoft.com/en-us/library/z50k9bft(v=vs.110).aspx
It looks like the designation of 32 exceeds the string length, which is 26. It appears that adding ".PadRight(32)" after the ... BUILD_DATE) corrects the problem. There are a few other places in the code, search for "LASzip DLL {0}" that will likely have this same problem.
Also, are you aware of the 1.4 version of Martin Isenburgs LasZip is pending and that could affect the ability of this code to read LAZ files in the future.
If you are able to continue this project, I think (after discussing it with Martin) that he would like to make the Lidar community more aware of your port. Note that we can provide some simple test code for read/write if you like.
Not an issue, apologies.
Hi, Is there a possibility to search points in the las file by footprint envelope and/or polygon? Or do I have to loop through all points and figure it out myself.
Hi, i have created a file Las from X,Y,Z points and it work.
Now i wont set the info of spatial reference (latitude, longitude etc..).
I have seen from specific of las files and i read that is important set the "number_of_extended_variable_length_records".
I dont understand how set all other information (latitude, longitude etc..).
can someone help me to set this information?? also an example is good.
Thx
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.