hi,<br><br>to have a "proper" LAS file you should set the number_of_returns_of_given_pulse and the return_number of each point (see the reamining warnings of lasinfo).<br><br>if you have one return per pulse ... set them both to 1.<br>
<br>and i guess i should put something into lasview that automatically detects it when the bounding box is set to 0 0 0 / 0 0 0 and then computes it on the fly ...<br><br>cheers,<br><br>martin<br><br><br><div class="gmail_quote">
On Fri, Aug 26, 2011 at 12:39 PM, James Hargrave <span dir="ltr"><<a href="mailto:jhargrave@photomodeler.com">jhargrave@photomodeler.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Hey guys,<br>
<br>
Thanks for the suggestions and help. Running the repair gave me the clue I<br>
needed. I wasn't setting the min/max values to the header.<br>
<br>
Here's the output from the repair:<br>
<div class="im">reporting all LAS header entries:<br>
file signature: 'LASF'<br>
file source ID: 0<br>
reserved (global_encoding):0<br>
project ID GUID data 1-4: 0 0 0 ''<br>
</div> version major.minor: 1.2<br>
system identifier: 'libLAS'<br>
generating software: 'libLAS 1.7.0b2'<br>
file creation day/year: 237/2011<br>
header size 227<br>
offset to point data 227<br>
<div class="im"> number var. length records 0<br>
</div> point data format 3<br>
point data record length 34<br>
number of point records 5857<br>
number of points by return 0 0 0 0 0<br>
<div class="im"> scale factor x y z 0.01 0.01 0.01<br>
offset x y z 0 0 0<br>
</div> min x y z 0.00 0.00 0.00<br>
max x y z 0.00 0.00 0.00<br>
<div class="im">reporting minimum and maximum for all LAS point record entries ...<br>
</div> x -1323 1581<br>
y -831 983<br>
z -3855 -1905<br>
intensity 0 0<br>
<div class="im"> edge_of_flight_line 0 0<br>
scan_direction_flag 0 0<br>
number_of_returns_of_given_pulse 0 0<br>
return_number 0 0<br>
classification 0 0<br>
scan_angle_rank 0 0<br>
user_data 0 0<br>
point_source_ID 0 0<br>
</div> gps_time 0.000000 0.000000<br>
Color R 0 220<br>
G 1 243<br>
B 0 255<br>
WARNING: there are 5857 points with return number 0<br>
WARNING: there are 5857 points with a number of returns of given pulse of 0<br>
<div class="im">histogram of classification of points:<br>
</div> 5857 Created, never classified (0)<br>
real max x larger than header max x by 15.810000 (repaired)<br>
real min x smaller than header min x by 13.230000 (repaired)<br>
real max y larger than header max y by 9.830000 (repaired)<br>
real min y smaller than header min y by 8.310000 (repaired)<br>
real min z smaller than header min z by 38.550000 (repaired)<br>
<br>
<br>
<br>
I added these lines after writing all the points (and computing the min/max<br>
during the write):<br>
<br>
header.SetMin( min.X(), min.Y(), min.Z() );<br>
header.SetMax( max.X(), max.Y(), max.Z() );<br>
<br>
writer->SetHeader(header);<br>
writer->WriteHeader();<br>
<br>
<br>
This fixed the problem.<br>
<br>
Are there any other fields I should be specifically setting?<br>
<br>
<br>
Heaps of thanks,<br>
- James<br>
<br>
<br>
<br>
> -----Original Message-----<br>
> From: Howard Butler [mailto:<a href="mailto:hobu.inc@gmail.com">hobu.inc@gmail.com</a>]<br>
> Sent: August-26-11 6:33 AM<br>
> To: James Hargrave<br>
> Cc: liblas-devel<br>
> Subject: Re: [Liblas-devel] Written file can't be read by other .las<br>
> viewers<br>
<div><div></div><div class="h5">><br>
><br>
> On Aug 26, 2011, at 8:11 AM, Howard Butler wrote:<br>
><br>
> ><br>
> > On Aug 25, 2011, at 6:16 PM, James Hargrave wrote:<br>
> ><br>
> >> Hello,<br>
> >><br>
> >> When I use laslib to create a file I am able to then read the file back<br>
> in<br>
> >> and everything seems fine. However, I am unable to view the file in<br>
> other<br>
> >> applications such as the lasview.exe utility found here:<br>
> >><br>
> >> <a href="http://www.cs.unc.edu/%7Eisenburg/lastools/" target="_blank">http://www.cs.unc.edu/~isenburg/lastools/</a><br>
> >><br>
> >> The steps I use mirror the C++ tutorial from the <a href="http://laslib.org" target="_blank">laslib.org</a> site:<br>
> >><br>
> >> ofs.open((char*)filename, ios::out | ios::binary);<br>
> >> liblas::Header header;<br>
> >><br>
> >> writer = new liblas::Writer(ofs, header);<br>
> >><br>
> >> Then in a loop:<br>
> >><br>
> >> liblas::Point point;<br>
> >> point.SetCoordinates(pt.X(), pt.Y(), pt.Z());<br>
> >><br>
> >> // fill other properties of point record<br>
> >> if ( rgb )<br>
> >> point.SetColor( liblas::Color( rgb[0], rgb[1], rgb[2] ) );<br>
> >><br>
> >> writer->WritePoint(point);<br>
> >><br>
> >><br>
> >> If anyone has any ideas I'd appreciate any suggestions. If it would<br>
> help I<br>
> >> can also provide a sample output file which I am able to read back in<br>
> using<br>
> >> liblas but does not appear when loaded into lasview.exe .<br>
> >><br>
> >> Thanks,<br>
> >> - James<br>
> ><br>
> ><br>
> > James,<br>
> ><br>
> > Which version of libLAS are you using? The following just worked for me<br>
> this morning with the latest git HEAD on <a href="https://github.com/libLAS/libLAS" target="_blank">https://github.com/libLAS/libLAS</a><br>
> ><br>
> > ~/liblas$ las2las TO_core_last_zoom.las lastools-test-from-liblas.las<br>
> > ~/lastools/bin/lasinfo lastools-test-from-liblas.las<br>
> ><br>
> >> reporting all LAS header entries:<br>
> >> file signature: 'LASF'<br>
> >> file source ID: 0<br>
> >> reserved (global_encoding):0<br>
> >> project ID GUID data 1-4: 0 0 0 ''<br>
> >> version major.minor: 1.0<br>
> >> system identifier: ''<br>
> >> generating software: 'TerraScan'<br>
> >> file creation day/year: 0/0<br>
> >> header size 227<br>
> >> offset to point data 229<br>
> >> number var. length records 0<br>
> >> point data format 1<br>
> >> point data record length 28<br>
> >> number of point records 213093<br>
> >> number of points by return 128621 84472 0 0 0<br>
> >> scale factor x y z 0.01 0.01 0.01<br>
> >> offset x y z -0 -0 -0<br>
> >> min x y z 630250.00 4834500.00 46.83<br>
> >> max x y z 630500.00 4834750.00 170.65<br>
> >> the header is followed by 2 user-defined bytes<br>
> >> reporting minimum and maximum for all LAS point record entries ...<br>
> >> x 63025000 63050000<br>
> >> y 483450000 483475000<br>
> >> z 4683 17065<br>
> >> intensity 10 50200<br>
> >> edge_of_flight_line 0 0<br>
> >> scan_direction_flag 0 0<br>
> >> number_of_returns_of_given_pulse 1 2<br>
> >> return_number 1 2<br>
> >> classification 1 1<br>
> >> scan_angle_rank 0 0<br>
> >> user_data 2 4<br>
> >> point_source_ID 0 0<br>
> >> gps_time 413162.560400 414095.322000<br>
> >> overview over number of returns of given pulse: 128621 84472 0 0 0 0 0<br>
> >> histogram of classification of points:<br>
> >> 213093 Unclassified (1)<br>
> ><br>
> ><br>
> > Are you making sure to delete the writer in your code? You must delete<br>
> the writer because it will be writing header details at the end of<br>
writing.<br>
> Also, make sure to do ofs.close() to force the flush of any data left in<br>
> the ostream buffer.<br>
><br>
> After some discussion on IRC with Martin, he suggested you run the<br>
> following:<br>
><br>
> ~/lastools $ lasinfo -repair file-written-by-liblas.las<br>
><br>
> I don't think your code is updating the header's bounds and return count<br>
> information, and this might be required for lasview.exe to run.<br>
><br>
> Howard<br>
<br>
<br>
</div></div></blockquote></div><br>