<br><br><div class="gmail_quote">On Fri, Jun 3, 2011 at 3:30 PM,  <span dir="ltr">&lt;<a href="mailto:Doug_Newcomb@fws.gov">Doug_Newcomb@fws.gov</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

<br><font size="2" face="sans-serif">Markus,</font>
<br><font size="2" face="sans-serif">        Were
you planning on adding filtering options by return number on v.in.lidar?
 It occurs to me that you could speed things up by only processing
the subset of the data that you want to use.   I could see it being
a useful thing to create a vector layer composed only of 1st returns (
top of canopy/buildings)  Selecting only last returns is useful, as
well as selecting points that are neither first nor last returns .  </font>
<br>
<br></blockquote><div>Yes, I was thinking of such filter options, they would be very easy and straightforward to implement, something like v.in.lidar returns=[all,first,last,middle]. Currently there is only spatial filtering available.<br>
<br>I was also thinking about an option to select columns to be imported as attributes, equivalent to the las2txt --parse option, but could not yet come up with a user-friendly solution: flags don&#39;t work because too many and conflicting with existing flags, a parse option very much like the one of las2txt is too cryptic. I think I will settle for something like v.in.lidar attributes=coords,classes,color,egde,angle,return,nreturns,... where the attributes option takes none, one or multiple answers<br>
<br>Markus M<br><br> <br></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><font size="2" face="sans-serif">        I&#39;ve
been primarily working with aggregate las files that I have dumped to text
( via liblas las2txt )  and then parse via python for first, middle,
and last  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:  &quot;) </font>
<br><font size="2" face="Courier New">outfil = raw_input(&quot;Enter the
ASCII output filename for the Lidar Data:  &quot;)</font>
<br><font size="2" face="Courier New">intxt=open(infile,&#39;r&#39;)</font>
<br><font size="2" face="Courier New">outtxt=open(outfil,&#39;w&#39;)</font>
<br><font size="2" face="Courier New">while 1:</font>
<br><font size="2" face="Courier New">    lasline=intxt.readline()</font>
<br><font size="2" face="Courier New">    lasinfo=lasline.split(&#39;,&#39;)</font>
<br><font size="2" face="Courier New">    if (len(lasinfo))&lt;
5:break</font>
<br><font size="2" face="Courier New">    numreturns=int(lasinfo[4])</font>
<br><font size="2" face="Courier New">    returnnum=int(lasinfo[5])</font>
<br><font size="2" face="Courier New">    # In the data input file
for this instance, the number of returns</font>
<br><font size="2" face="Courier New">    # 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">    # If the value of these
colums is equal, it should be the last return.</font>
<br><font size="2" face="Courier New">    if ( numreturns==returnnum):</font>
<br><font size="2" face="Courier New">        outtxt.write(lasline)</font>
<br>
<br><font size="2" face="Courier New">    </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,  </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:  &quot;) </font>
<br><font size="2" face="Courier New">outfil = raw_input(&quot;Enter the
ASCII output filename for the Lidar Data:  &quot;)</font>
<br><font size="2" face="Courier New">intxt=open(infile,&#39;r&#39;)</font>
<br><font size="2" face="Courier New">outtxt=open(outfil,&#39;w&#39;)</font>
<br><font size="2" face="Courier New">while 1:</font>
<br><font size="2" face="Courier New">    lasline=intxt.readline()</font>
<br><font size="2" face="Courier New">    lasinfo=lasline.split(&#39;,&#39;)</font>
<br><font size="2" face="Courier New">    if (len(lasinfo))&lt;
5:break</font>
<br><font size="2" face="Courier New">    numreturns=int(lasinfo[4])</font>
<br><font size="2" face="Courier New">    returnnum=int(lasinfo[5])</font>
<br><font size="2" face="Courier New">    # In the data input file
for this instance, the number of returns</font>
<br><font size="2" face="Courier New">    # 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">    # 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">    # If the return number
is 1 , skip that value.  All other values are middle canopy values,which
is what we want.</font>
<br><font size="2" face="Courier New">    if ( numreturns==returnnum):
continue</font>
<br><font size="2" face="Courier New">    if (returnnum==1):continue</font>
<br><font size="2" face="Courier New">    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.  I haven&#39;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&#39;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.  It works great for large datasets( &gt; 4
billion points) , but I&#39;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        
    <br>
USFWS<br>
Raleigh, NC<br>
<a href="tel:919-856-4520%20ext.%2014" value="+19198564520" target="_blank">919-856-4520 ext. 14</a> <a href="mailto:doug_newcomb@fws.gov" target="_blank">doug_newcomb@fws.gov</a><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.  
Life is too short for undocumented, proprietary data formats.</font>
<br>
<br>
<br>
<p></p><table width="100%">
<tbody><tr valign="top">
<td width="40%"><font size="1" face="sans-serif"><b>Markus Metz &lt;<a href="mailto:markus.metz.giswork@googlemail.com" target="_blank">markus.metz.giswork@googlemail.com</a>&gt;</b>
</font>
<br><font size="1" face="sans-serif">Sent by: <a href="mailto:grass-dev-bounces@lists.osgeo.org" target="_blank">grass-dev-bounces@lists.osgeo.org</a></font>
<p><font size="1" face="sans-serif">06/03/2011 02:20 AM</font>
</p></td><td width="59%">
<table width="100%">
<tbody><tr valign="top">
<td>
<div align="right"><font size="1" face="sans-serif">To</font></div>
</td><td><font size="1" face="sans-serif">Hamish &lt;<a href="mailto:hamish_b@yahoo.com" target="_blank">hamish_b@yahoo.com</a>&gt;</font>
</td></tr><tr valign="top">
<td>
<div align="right"><font size="1" face="sans-serif">cc</font></div>
</td><td><font size="1" face="sans-serif">GRASS developers list &lt;<a href="mailto:grass-dev@lists.osgeo.org" target="_blank">grass-dev@lists.osgeo.org</a>&gt;</font>
</td></tr><tr valign="top">
<td>
<div align="right"><font size="1" face="sans-serif">Subject</font></div>
</td><td><font size="1" face="sans-serif">[GRASS-dev] Re: [GRASS-user] LiDAR LAS
import</font></td></tr></tbody></table>
<br>
<table>
<tbody><tr valign="top">
<td>
</td><td></td></tr></tbody></table>
<br></td></tr></tbody></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&#39;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    6m34.430s<br>
&gt; ...<br>
&gt;&gt; real    6m13.823s<br>
&gt; ...<br>
&gt;&gt; # without table, with topology<br>
&gt; ...<br>
&gt;&gt; real    1m53.578s<br>
&gt; ...<br>
&gt;&gt; real    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                
0m20.932s<br>
user                
0m18.424s<br>
sys                
0m6.869s<br>
<br>
<br>
time v.in.lidar in=points.las out=points_las -obt<br>
<br>
real                
0m9.117s<br>
user                
0m2.946s<br>
sys                
0m5.985s<br>
<br>
<br>
Markus M<br>
_______________________________________________<br>
grass-dev mailing list<br>
<a href="mailto:grass-dev@lists.osgeo.org" target="_blank">grass-dev@lists.osgeo.org</a><br>
</font></tt><a href="http://lists.osgeo.org/mailman/listinfo/grass-dev" target="_blank"><tt><font size="2">http://lists.osgeo.org/mailman/listinfo/grass-dev<br>
</font></tt></a>
<br></blockquote></div><br>