<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><font size=2 face="sans-serif"> I'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("Enter the
aggregate lidar filename: ") </font>
<br><font size=2 face="Courier New">outfil = raw_input("Enter the
ASCII output filename for the Lidar Data: ")</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"> lasline=intxt.readline()</font>
<br><font size=2 face="Courier New"> lasinfo=lasline.split(',')</font>
<br><font size=2 face="Courier New"> if (len(lasinfo))<
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 "middle" 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("Enter the
aggregate lidar filename: ") </font>
<br><font size=2 face="Courier New">outfil = raw_input("Enter the
ASCII output filename for the Lidar Data: ")</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"> lasline=intxt.readline()</font>
<br><font size=2 face="Courier New"> lasinfo=lasline.split(',')</font>
<br><font size=2 face="Courier New"> if (len(lasinfo))<
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'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. It works great for large datasets( > 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
<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.
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 <markus.metz.giswork@googlemail.com></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 <hamish_b@yahoo.com></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 <grass-dev@lists.osgeo.org></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>
> Markus Metz wrote:<br>
[snip]<br>
><br>
>> v.in.lidar is a notch faster than las2txt | v.in.ascii. And<br>
>> easier to use...<br>
><br>
> I'm not too surprised the speed difference is not so huge, as<br>
> unix pipes are very efficient. but the easier to use thing is<br>
> very important.. both las2txt and v.in.ascii are a bundle of<br>
> command line switches to get right.<br>
><br>
><br>
>> Speed comparisons:<br>
>><br>
>> # sample las file with 1,287,775 points<br>
>><br>
>> # with table and topology<br>
> ...<br>
>> real 6m34.430s<br>
> ...<br>
>> real 6m13.823s<br>
> ...<br>
>> # without table, with topology<br>
> ...<br>
>> real 1m53.578s<br>
> ...<br>
>> real 1m44.876s<br>
><br>
><br>
> 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 "|"
|<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>
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>