<br><font size=2 face="sans-serif">Markus,</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; Were
you planning on adding filtering options by return number on v.in.lidar?
&nbsp;It occurs to me that you could speed things up by only processing
the subset of the data that you want to use. &nbsp; I could see it being
a useful thing to create a vector layer composed only of 1st returns (
top of canopy/buildings) &nbsp;Selecting only last returns is useful, as
well as selecting points that are neither first nor last returns . &nbsp;</font>
<br>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; I've
been primarily working with aggregate las files that I have dumped to text
( via liblas las2txt ) &nbsp;and then parse via python for first, middle,
and last &nbsp;returns. I have not taken the time to learn C yet, but perhaps
the logic of these simple python programs would be useful .</font>
<br>
<br><font size=2 face="sans-serif">The following is the python script I
use to separate the last returns.</font>
<br><font size=2 face="sans-serif">---------------------------------------------------------------------------------------------------------------------------------</font>
<br><font size=2 face="Courier New">import struct,os,string,re,binascii,glob</font>
<br><font size=2 face="Courier New">infile = raw_input(&quot;Enter the
aggregate lidar filename: &nbsp;&quot;) </font>
<br><font size=2 face="Courier New">outfil = raw_input(&quot;Enter the
ASCII output filename for the Lidar Data: &nbsp;&quot;)</font>
<br><font size=2 face="Courier New">intxt=open(infile,'r')</font>
<br><font size=2 face="Courier New">outtxt=open(outfil,'w')</font>
<br><font size=2 face="Courier New">while 1:</font>
<br><font size=2 face="Courier New">&nbsp; &nbsp; lasline=intxt.readline()</font>
<br><font size=2 face="Courier New">&nbsp; &nbsp; lasinfo=lasline.split(',')</font>
<br><font size=2 face="Courier New">&nbsp; &nbsp; if (len(lasinfo))&lt;
5:break</font>
<br><font size=2 face="Courier New">&nbsp; &nbsp; numreturns=int(lasinfo[4])</font>
<br><font size=2 face="Courier New">&nbsp; &nbsp; returnnum=int(lasinfo[5])</font>
<br><font size=2 face="Courier New">&nbsp; &nbsp; # In the data input file
for this instance, the number of returns</font>
<br><font size=2 face="Courier New">&nbsp; &nbsp; # is the fifth column,
and the return number is the sixth column ( x=1,y=2,z=3,intensity=4).</font>
<br><font size=2 face="Courier New">&nbsp; &nbsp; # If the value of these
colums is equal, it should be the last return.</font>
<br><font size=2 face="Courier New">&nbsp; &nbsp; if ( numreturns==returnnum):</font>
<br><font size=2 face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp; outtxt.write(lasline)</font>
<br>
<br><font size=2 face="Courier New">&nbsp; &nbsp; </font>
<br><font size=2 face="Courier New">intxt.close()</font>
<br><font size=2 face="Courier New">outtxt.close()</font>
<br><font size=2 face="sans-serif">--------------------------------------------------------------------------------------------------------------------------------</font>
<br><font size=2 face="sans-serif">For parsing the first returns, &nbsp;</font><font size=2 face="Courier New">substitute
if (returnnum==1):</font>
<br>
<br><font size=2 face="sans-serif">Here is the python script I use to separate
out the &quot;middle&quot; returns.</font>
<br>
<br><font size=2 face="sans-serif">-------------------------------------------------------------------------------------------------------------------------------</font>
<br>
<br><font size=2 face="Courier New">import struct,os,string,re,binascii,glob</font>
<br><font size=2 face="Courier New">infile = raw_input(&quot;Enter the
aggregate lidar filename: &nbsp;&quot;) </font>
<br><font size=2 face="Courier New">outfil = raw_input(&quot;Enter the
ASCII output filename for the Lidar Data: &nbsp;&quot;)</font>
<br><font size=2 face="Courier New">intxt=open(infile,'r')</font>
<br><font size=2 face="Courier New">outtxt=open(outfil,'w')</font>
<br><font size=2 face="Courier New">while 1:</font>
<br><font size=2 face="Courier New">&nbsp; &nbsp; lasline=intxt.readline()</font>
<br><font size=2 face="Courier New">&nbsp; &nbsp; lasinfo=lasline.split(',')</font>
<br><font size=2 face="Courier New">&nbsp; &nbsp; if (len(lasinfo))&lt;
5:break</font>
<br><font size=2 face="Courier New">&nbsp; &nbsp; numreturns=int(lasinfo[4])</font>
<br><font size=2 face="Courier New">&nbsp; &nbsp; returnnum=int(lasinfo[5])</font>
<br><font size=2 face="Courier New">&nbsp; &nbsp; # In the data input file
for this instance, the number of returns</font>
<br><font size=2 face="Courier New">&nbsp; &nbsp; # is the fifth column,
and the return number is the sixth column ( x=1,y=2,z=3,intensity=4).</font>
<br><font size=2 face="Courier New">&nbsp; &nbsp; # If the value of these
colums is equal, it should be the last return, so skip that entry</font>
<br><font size=2 face="Courier New">&nbsp; &nbsp; # If the return number
is 1 , skip that value. &nbsp;All other values are middle canopy values,which
is what we want.</font>
<br><font size=2 face="Courier New">&nbsp; &nbsp; if ( numreturns==returnnum):
continue</font>
<br><font size=2 face="Courier New">&nbsp; &nbsp; if (returnnum==1):continue</font>
<br><font size=2 face="Courier New">&nbsp; &nbsp; outtxt.write(lasline)</font>
<br><font size=2 face="Courier New">intxt.close()</font>
<br><font size=2 face="Courier New">outtxt.close()</font>
<br><font size=2 face="sans-serif">------------------------------------------------------------------------------------------------------------------------------</font>
<br>
<br><font size=2 face="sans-serif">I really appreciate your adding lidar
data classifications from the standard into the program. &nbsp;I haven't
actually seen any lidar data with classifications yet, but I have hope
for the future :-). </font>
<br>
<br><font size=2 face="sans-serif">As a bit of background , I'm taking
the last returns and then running r.in.xyz to create a raster with the
intensities as the z values to get relative soil moistures, and looking
at points that are neither first nor last returns as a possible measure
of vegetation density. &nbsp;It works great for large datasets( &gt; 4
billion points) , but I'm feeling the need for more point analysis.</font>
<br>
<br><font size=2 face="sans-serif">Doug</font>
<br>
<br>
<br><font size=2 face="sans-serif">Doug Newcomb &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; <br>
USFWS<br>
Raleigh, NC<br>
919-856-4520 ext. 14 doug_newcomb@fws.gov<br>
---------------------------------------------------------------------------------------------------------<br>
The opinions I express are my own and are not representative of the official
policy of the U.S.Fish and Wildlife Service or Dept. of the Interior. &nbsp;
Life is too short for undocumented, proprietary data formats.</font>
<br>
<br>
<br>
<table width=100%>
<tr valign=top>
<td width=40%><font size=1 face="sans-serif"><b>Markus Metz &lt;markus.metz.giswork@googlemail.com&gt;</b>
</font>
<br><font size=1 face="sans-serif">Sent by: grass-dev-bounces@lists.osgeo.org</font>
<p><font size=1 face="sans-serif">06/03/2011 02:20 AM</font>
<td width=59%>
<table width=100%>
<tr valign=top>
<td>
<div align=right><font size=1 face="sans-serif">To</font></div>
<td><font size=1 face="sans-serif">Hamish &lt;hamish_b@yahoo.com&gt;</font>
<tr valign=top>
<td>
<div align=right><font size=1 face="sans-serif">cc</font></div>
<td><font size=1 face="sans-serif">GRASS developers list &lt;grass-dev@lists.osgeo.org&gt;</font>
<tr valign=top>
<td>
<div align=right><font size=1 face="sans-serif">Subject</font></div>
<td><font size=1 face="sans-serif">[GRASS-dev] Re: [GRASS-user] LiDAR LAS
import</font></table>
<br>
<table>
<tr valign=top>
<td>
<td></table>
<br></table>
<br>
<br>
<br><tt><font size=2>Hamish wrote:<br>
&gt; Markus Metz wrote:<br>
[snip]<br>
&gt;<br>
&gt;&gt; v.in.lidar is a notch faster than las2txt | v.in.ascii. And<br>
&gt;&gt; easier to use...<br>
&gt;<br>
&gt; I'm not too surprised the speed difference is not so huge, as<br>
&gt; unix pipes are very efficient. but the easier to use thing is<br>
&gt; very important.. both las2txt and v.in.ascii are a bundle of<br>
&gt; command line switches to get right.<br>
&gt;<br>
&gt;<br>
&gt;&gt; Speed comparisons:<br>
&gt;&gt;<br>
&gt;&gt; # sample las file with 1,287,775 points<br>
&gt;&gt;<br>
&gt;&gt; # with table and topology<br>
&gt; ...<br>
&gt;&gt; real&nbsp;&nbsp;&nbsp; 6m34.430s<br>
&gt; ...<br>
&gt;&gt; real&nbsp;&nbsp;&nbsp; 6m13.823s<br>
&gt; ...<br>
&gt;&gt; # without table, with topology<br>
&gt; ...<br>
&gt;&gt; real&nbsp;&nbsp;&nbsp; 1m53.578s<br>
&gt; ...<br>
&gt;&gt; real&nbsp;&nbsp;&nbsp; 1m44.876s<br>
&gt;<br>
&gt;<br>
&gt; I take it that without topology it runs in just seconds?<br>
<br>
Update: no attribute table, no topology<br>
<br>
time las2txt -i points.las --stdout --parse xyz --delimiter &quot;|&quot;
|<br>
v.in.ascii in=- out=points_ascii -ztb x=1 y=2 z=3<br>
<br>
real &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
0m20.932s<br>
user &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
0m18.424s<br>
sys &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
0m6.869s<br>
<br>
<br>
time v.in.lidar in=points.las out=points_las -obt<br>
<br>
real &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
0m9.117s<br>
user &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
0m2.946s<br>
sys &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
0m5.985s<br>
<br>
<br>
Markus M<br>
_______________________________________________<br>
grass-dev mailing list<br>
grass-dev@lists.osgeo.org<br>
</font></tt><a href="http://lists.osgeo.org/mailman/listinfo/grass-dev"><tt><font size=2>http://lists.osgeo.org/mailman/listinfo/grass-dev<br>
</font></tt></a>
<br>