I am trying to convert an ascii file to a las file. The ascii data comes like this (x,y,z,intensity,beam width,???,return,number of returns):
4397946.84 5693254.11 495.07 16 40 3 4 4
4397941.42 5693255.92 529.49 25 49 3 1 3
4397942.22 5693255.66 524.31 25 71 3 2 3
4397946.68 5693254.22 495.05 78 42 3 3 3
4397941.30 5693256.02 529.27 53 43 3 1 2
4397946.51 5693254.34 495.04 116 42 3 2 2
4397940.78 5693256.24 531.72 25 50 3 1 3
4397941.60 5693255.98 526.31 20 *** 3 2 3
txt2las -i ascii.xyz -olas -odir .\tmp -parse xyzi0srn -add_attribute 3 "echo width" "beam with" -set_version 1.2
Which works o.k. except the following warnings and observations:
1.) I get always a warning: WARNING: written 10247677 points but expected 0 points.
What does this say? Why is 0 expected
2.) In some cases I get the warning that the return number of 7 can not be coded with 3 bit.
How can I change the bit number to e.g. 4 for returns and #returns?
3.) For some reason which I don't know, some of the intensity values the text file include '***' as in the last line of the example.
These points are completly skipped by txt2las. Is there an option to set these values to NA?
4.) The original ascii files have the ending *asc. However, if I try to import from these I get the following:
ERROR: was not able to find header
ERROR: cannot open lasreaderasc with file name '4374386_4375598_5683610_5685092_Spur0171.asc'
ERROR: could not open lasreader
My current solution is to rename the files to *xyz. Any better options?
I would appriciate any help.
Cheers Paul
--
Download LAStools at
http://lastools.org
http://rapidlasso.com
Be social with LAStools at
http://facebook.com/LAStools
http://twitter.com/LAStools
http://linkedin.com/groups/LAStools-4408378
Manage your settings at
http://groups.google.com/group/lastools/subscribe
Seems to be true that scientists spend 90% of their time of converting their data from one format to another ... (-:
Note ... the value '3' that you make '???' might be the point source ID. As you have no GPS time stamps your only hope is the point source IDs for being able to do quality checks (flightline alignment and overlap). Unless your input files *are* flight lines.
Which works o.k. except the following warnings and observations:
1.) I get always a warning: WARNING: written 10247677 points but expected 0 points.
What does this say? Why is 0 expectedThis is just the way that LASlib is setup right now. A LAS writer needs to write the header first and thus has to populate the field specifying the number of points. For ASCII conversion that knowledge would require an extra pass just to count the points and compute the bounding box (which is also an option and needed when *piping* the output into a LAS file or another processing stage). Hence the number is simply written as zero. When LASlib notices that the number of points written is different from the number initially specified it will fix the header (unless it is *piping* when seeking back is not possible) but report a WARNING. I guess I could omit the WARNING when the "expectation" was 0 as that should always indicate that the value was not known ahead of time.
2.) In some cases I get the warning that the return number of 7 can not be coded with 3 bit.
How can I change the bit number to e.g. 4 for returns and #returns?But a return number of 7 can be coded with 3 bits. We need an example here.
3.) For some reason which I don't know, some of the intensity values the text file include '***' as in the last line of the example.
These points are completly skipped by txt2las. Is there an option to set these values to NA?The parser looks for the right number of values. If they are not found the line is skipped. You could search/replace those to (possibly via a pipe) with 0 and then declare 0 to be the nodata value when you specify the "extra bytes".
4.) The original ascii files have the ending *asc. However, if I try to import from these I get the following:
ERROR: was not able to find header
ERROR: cannot open lasreaderasc with file name '4374386_4375598_5683610_5685092_Spur0171.asc'
ERROR: could not open lasreader
My current solution is to rename the files to *xyz. Any better options?The *.asc ending makes LASlib expect an ASCII *.asc raster file. Currently there is no option to *force* the *.txt reader onto a *.asc file but it may be a good idea to rename those. I seem to remember the same issue when I got the LiDAR from "Nationalpark Bayrischer Wald" ... simply runrename *.asc *.txtorrename *.asc *.xyzin the Windows command line to give them more appropriate names.
So I guess that the old '???' was the point source ID. What would be the best 'lastools' option to check that?
2.) In some cases I get the warning that the return number of 7 can not be coded with 3 bit. How can I change the bit number to e.g. 4 for returns and #returns?But a return number of 7 can be coded with 3 bits. We need an example here.
Sorry that was a typo. The warning says : 8 can not be coded with 3 bits
3.) For some reason which I don't know, some of the intensity values the text file include '***' as in the last line of the example.
These points are completly skipped by txt2las. Is there an option to set these values to NA?The parser looks for the right number of values. If they are not found the line is skipped. You could search/replace those to (possibly via a pipe) with 0 and then declare 0 to be the nodata value when you specify the "extra bytes".
Ok, I replaced the '***' by '0' now using notepad++ (seems to much faster then any regular expression in cmd or powershell). How can I declare 0 as no data for intensity using the 'extra bytes' ?
lasview -i lidar.laz -color_by_flightline
lasinfo -i lidar.laz -nh -nv -nr -nmm -histo point_source 1
If you want to properly store 8 or more returns to a LAS / LAZ file you will need to use point type 6 of LAS 1.4 that supports up to 15 returns per pulse. Would that be an option?
--
PROJCS["DHDN / Gauss-Kruger zone 4", GEOGCS["DHDN", DATUM["Deutsches_Hauptdreiecksnetz", SPHEROID["Bessel 1841",6377397.155,299.1528128, AUTHORITY["EPSG","7004"]], AUTHORITY["EPSG","6314"]], PRIMEM["Greenwich",0, AUTHORITY["EPSG","8901"]], UNIT["degree",0.01745329251994328, AUTHORITY["EPSG","9122"]], AUTHORITY["EPSG","4314"]], UNIT["metre",1, AUTHORITY["EPSG","9001"]], PROJECTION["Transverse_Mercator"], PARAMETER["latitude_of_origin",0], PARAMETER["central_meridian",12], PARAMETER["scale_factor",1], PARAMETER["false_easting",4500000], PARAMETER["false_northing",0], AUTHORITY["EPSG","31468"], AXIS["Y",EAST], AXIS["X",NORTH]]
PROJCS["WGS 84 / UTM zone 32N", GEOGCS["WGS 84", DATUM["WGS_1984", SPHEROID["WGS 84",6378137,298.257223563, AUTHORITY["EPSG","7030"]], AUTHORITY["EPSG","6326"]], PRIMEM["Greenwich",0, AUTHORITY["EPSG","8901"]], UNIT["degree",0.01745329251994328, AUTHORITY["EPSG","9122"]], AUTHORITY["EPSG","4326"]], UNIT["metre",1, AUTHORITY["EPSG","9001"]], PROJECTION["Transverse_Mercator"], PARAMETER["latitude_of_origin",0], PARAMETER["central_meridian",9], PARAMETER["scale_factor",0.9996], PARAMETER["false_easting",500000], PARAMETER["false_northing",0], AUTHORITY["EPSG","32632"], AXIS["Easting",EAST], AXIS["Northing",NORTH]]
Hello,turns our that Howard Butler's libLAS has a bug when asked to compress a LAS file with "extra bytes" (meaning a point type that uses more bytes per point than the point type needs that usually contain some user defined attributes). It does not compress the extra bytes (simply omits them) but does not change the LAS header which still indicates that they are there.I have added a new "check" to LAStools that finds such corrupt LAZ files and exits early. This will be included in the next release of LAStools.
E:\LAStools\bin>lasinfo -i paul_liblas.lazlasinfo (170408) report for paul_liblas.lazERROR: point has size of 35 but items only add up to 28 bytes (LASzip v3.0r0)please upgrade to the latest release of LAStools (with LASzip)
or contact 'martin.isenburg@rapidlasso.com' for assistance.