<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://grasswiki.osgeo.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=%E2%9A%A0%EF%B8%8FJohn+Tate</id>
	<title>GRASS-Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://grasswiki.osgeo.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=%E2%9A%A0%EF%B8%8FJohn+Tate"/>
	<link rel="alternate" type="text/html" href="https://grasswiki.osgeo.org/wiki/Special:Contributions/%E2%9A%A0%EF%B8%8FJohn_Tate"/>
	<updated>2026-05-25T17:08:05Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>https://grasswiki.osgeo.org/w/index.php?title=LIDAR&amp;diff=10096</id>
		<title>LIDAR</title>
		<link rel="alternate" type="text/html" href="https://grasswiki.osgeo.org/w/index.php?title=LIDAR&amp;diff=10096"/>
		<updated>2010-01-08T18:10:57Z</updated>

		<summary type="html">&lt;p&gt;⚠️John Tate: /* DEM/DSM separation the more complex way */ removed windows issues. likely to be wrong, have spoken with Hamish about this. Could have been due to bug #809&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;h1&amp;gt; LIDAR and Multi-beam Swath bathymetry data &amp;lt;/h1&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Modules ==&lt;br /&gt;
&lt;br /&gt;
=== Import ===&lt;br /&gt;
&lt;br /&gt;
* {{cmd|r.in.xyz}} - Create a raster map from an assemblage of many coordinates using univariate statistics. ([http://hamish.bowman.googlepages.com/grassfiles#xyz example])&lt;br /&gt;
&lt;br /&gt;
* {{cmd|v.in.ascii}} - Import data from an ASCII file to GRASS vector format.&lt;br /&gt;
: ''Due to memory overhead vector point imports will be limited to a few million data points unless topology and database creation is skipped with the '''-bt''' flags''. It may also be useful to clip the import file to only accept points falling within the current region by using the '''-r''' flag. See {{cmd|g.region}} for details on specifying the region bounds.&lt;br /&gt;
&lt;br /&gt;
=== Analysis ===&lt;br /&gt;
&lt;br /&gt;
* {{cmd|v.outlier}} - Removes outliers from vector point data.&lt;br /&gt;
&lt;br /&gt;
* {{cmd|v.lidar.edgedetection}} - Detect the object's edges from a LIDAR data set.&lt;br /&gt;
&lt;br /&gt;
* {{cmd|v.lidar.growing}} - Building contour determination and Region Growing algorithm for determining the building inside.&lt;br /&gt;
&lt;br /&gt;
* {{cmd|v.lidar.correction}} - Correction of the v.lidar.growing output. It is the last of the three algorithms for LIDAR filtering.&lt;br /&gt;
&lt;br /&gt;
=== Surface generation ===&lt;br /&gt;
&lt;br /&gt;
* {{cmd|v.surf.rst}} - Spatial approximation and topographic analysis using regularized spline with tension.&lt;br /&gt;
&lt;br /&gt;
* {{cmd|v.surf.idw}} - Surface interpolation from vector point data by Inverse Distance Squared Weighting.&lt;br /&gt;
&lt;br /&gt;
* {{cmd|v.surf.bspline}} - Surface interpolation from vector point data by bicubic or bilineal interpolation with Tykhonov regularization.&lt;br /&gt;
&lt;br /&gt;
* {{cmd|r.fillnulls}} - Fills no-data areas in raster maps using v.surf.rst splines interpolation.&lt;br /&gt;
&lt;br /&gt;
== Swath Bathymetry Tools ==&lt;br /&gt;
&lt;br /&gt;
''see also the [[Marine_Science#Multibeam_sonar_processing]] wiki page''&lt;br /&gt;
&lt;br /&gt;
* The [http://david.p.finlayson.googlepages.com/swathwidth v.swathwidith] module by David Finlayson for planning surveys. (development page)&lt;br /&gt;
&lt;br /&gt;
* An example of [http://bambi.otago.ac.nz/hamish/grass/gdal/sidescan_warp.html post-processing scanned paper sidescan swaths] using thin plate spline warping with [http://www.gdal.org/ GDAL's] &amp;quot;&amp;lt;tt&amp;gt;gdalwarp -tps&amp;lt;/tt&amp;gt;&amp;quot; function. (debugging page)&lt;br /&gt;
&lt;br /&gt;
* [[MB-System|GRASS integration]] with [http://www.ldeo.columbia.edu/res/pi/MB-System/ MB-System] (GPL) software for processing Multibeam and Sidescan Sonar data. GRASS + [[MB-System|MBsys]] + [[GMT]] make a nice scriptable trio.&lt;br /&gt;
&lt;br /&gt;
== LIDAR Tools ==&lt;br /&gt;
&lt;br /&gt;
*  {{cmd|r.terraflow}} - computation of flow direction, flow accumulation and other basic topographic terrain indices from massive raster digital elevation models (DEM). From the Duke University [http://terrain.cs.duke.edu/ STREAM] project.&lt;br /&gt;
&lt;br /&gt;
* [http://mpa.itc.it/markus/grass61/demos/rlake/ Flood simulation] using {{cmd|r.lake}}. Includes fancy NVIZ visualization of Trento, Italy, by Markus Neteler.&lt;br /&gt;
&lt;br /&gt;
* [http://www.cs.unc.edu/~isenburg/software/ LAStools] are a set of simple command line tools  (including source code) for converting to/from ASCII, viewing, comparing, and compressing LIDAR data.&lt;br /&gt;
&lt;br /&gt;
* [http://www.liblas.org libLAS] ASPRS LiDAR data translation tools&lt;br /&gt;
&lt;br /&gt;
* See also [[LIDAR#Analysis|LIDAR Analysis]]&lt;br /&gt;
&lt;br /&gt;
== Micro-tutorial for LAS data==&lt;br /&gt;
&lt;br /&gt;
=== Preparation ===&lt;br /&gt;
&lt;br /&gt;
==== Conversion of text files to LAS ====&lt;br /&gt;
&lt;br /&gt;
[http://www.liblas.org/ libLAS] supports the following column types:&lt;br /&gt;
   x - x coordinate&lt;br /&gt;
   y - y coordinate&lt;br /&gt;
   z - z coordinate&lt;br /&gt;
   a - scan angle&lt;br /&gt;
   i - intensity&lt;br /&gt;
   n - number of returns for given pulse (1..n)&lt;br /&gt;
   r - number of this return (1..r)&lt;br /&gt;
   c - classification&lt;br /&gt;
   u - user data (but only 1 byte)&lt;br /&gt;
   p - point source ID&lt;br /&gt;
   e - edge of flight line&lt;br /&gt;
   d - direction of scan flag&lt;br /&gt;
   t - GPS time&lt;br /&gt;
   s - skip column&lt;br /&gt;
&lt;br /&gt;
Sample text data such as:&lt;br /&gt;
   returntime,pulse,east,north,height,intensity,stripe&lt;br /&gt;
   549778.907200,1,673999.940,5099680.080,507.425,20.0,45105&lt;br /&gt;
   ...&lt;br /&gt;
&lt;br /&gt;
can be converted to LAS format like this:&lt;br /&gt;
   returntime - t&lt;br /&gt;
   pulse - r&lt;br /&gt;
   east - x&lt;br /&gt;
   north - y&lt;br /&gt;
   height - z&lt;br /&gt;
   intensity - i&lt;br /&gt;
   stripe - s&lt;br /&gt;
&lt;br /&gt;
First parse (sanity check):&lt;br /&gt;
   txt2las -parse trxyzis data.asc&lt;br /&gt;
&lt;br /&gt;
Then convert:&lt;br /&gt;
   txt2las -parse trxyzis -i data.asc -o data.las &lt;br /&gt;
&lt;br /&gt;
While you may not need to do this conversion for GRASS import, the resulting files are way smaller than the uncompressed text files; additionally, they are in a defined format.&lt;br /&gt;
&lt;br /&gt;
=== LAS Import ===&lt;br /&gt;
&lt;br /&gt;
* Use the [http://www.liblas.org libLAS] utilities to import LAS data into GRASS. &lt;br /&gt;
* Data stored in text files can generally be imported directly into GRASS.&lt;br /&gt;
&lt;br /&gt;
* The data used in the rest of this micro-tutorial can be found at [http://www.appliedimagery.com/Serpent%20Mound%20Model%20LAS%20Data.las appliedimagery.com].&lt;br /&gt;
&lt;br /&gt;
==== Import LAS as raster DEM ====&lt;br /&gt;
&lt;br /&gt;
Check bounds and SRS:&lt;br /&gt;
 $ lasinfo &amp;quot;Serpent_Mound_Model_LAS_Data.las&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
  [...]&lt;br /&gt;
  Min X Y Z                  289020.900000 4320942.610000 166.780000&lt;br /&gt;
  Max X Y Z                  290106.020000 4323641.570000 215.480000&lt;br /&gt;
 Spatial Reference           +proj=utm +zone=17 +ellps=WGS84 +units=m &lt;br /&gt;
&lt;br /&gt;
After creating a suitable UTM zone 17 location (EPSG:32617) &lt;br /&gt;
set the region according to the information from lasinfo at 1m resolution, rounding grid outwards to align to whole meters:&lt;br /&gt;
 GRASS&amp;gt; {{cmd|g.region}} n=4323641.57 s=4320942.61 w=289020.90 e=290106.02 res=1 -ap&lt;br /&gt;
&lt;br /&gt;
Finally, import with {{cmd|r.in.xyz}} with data piped directly from the &amp;lt;tt&amp;gt;las2txt&amp;lt;/tt&amp;gt; program and set a nice equalized color table:&lt;br /&gt;
 BASEMAP=&amp;quot;Serpent_Mound_Model_LAS&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 las2txt --stdout &amp;quot;${BASEMAP}_Data.las&amp;quot; | \&lt;br /&gt;
    r.in.xyz in=- out=${BASEMAP}_Data fs=space method=mean&lt;br /&gt;
 &lt;br /&gt;
 {{cmd|r.colors}} ${BASEMAP}_Data color=bcyr -e&lt;br /&gt;
&lt;br /&gt;
The above example uses the default z-elevation level as the 3rd term, but by using the &amp;lt;tt&amp;gt;las2txt --parse&amp;lt;/tt&amp;gt; command other fields (such as intensity) can be imported instead via &amp;quot;&amp;lt;tt&amp;gt;--parse xyi&amp;lt;/tt&amp;gt;&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
==== Import LAS as vector points ====&lt;br /&gt;
&lt;br /&gt;
Region setting (establishing the grid) is not needed for vector features so we can go directly to the import step. To deal with millions of input points {{cmd|v.in.ascii}} should be run with the options to skip creation of an attribute database and building topology as these can consume large amounts of memory. Note that vector maps without topology built are somewhat limited in their ability to be processed. Most LIDAR specific modules have been adapted to not require &lt;br /&gt;
topology. Even so, after initial cleaning steps it is often more efficient to work with huge datasets in GRASS as raster data.&lt;br /&gt;
&lt;br /&gt;
 las2txt --stdout &amp;quot;${BASEMAP}_Data.las&amp;quot; | \&lt;br /&gt;
   v.in.ascii -tbz z=3 out=&amp;quot;${BASEMAP}_pts&amp;quot; fs=space&lt;br /&gt;
&lt;br /&gt;
If topology was built, you can use {{cmd|d.vect}}'s -z flag to colorize by elevation value. Without topology you can still colorize, but you need to use color rules based on absolute elevations, not percentage of scale.&lt;br /&gt;
&amp;lt;!-- need an absolute color map gradiated across the elev range --&amp;gt;&lt;br /&gt;
 # display colorized points for data with built topology&lt;br /&gt;
 d.vect map=lidar_pts size=1 -z zcolor=elevation&lt;br /&gt;
&lt;br /&gt;
* After import as points you can then use the v.lidar tools to clean the data: {{cmd|v.lidar.correction}}, {{cmd|v.lidar.edgedetection}}, {{cmd|v.lidar.growing}}, and {{cmd|v.outlier}}.&lt;br /&gt;
&lt;br /&gt;
* Vector points can be interpolated into raster DEMs with a number of modules, including {{cmd|v.surf.rst}}, {{cmd|v.surf.bspline}}, and {{cmd|v.surf.idw}}.&lt;br /&gt;
&lt;br /&gt;
=== Clean imported raster DEM ===&lt;br /&gt;
&lt;br /&gt;
(fill holes)&lt;br /&gt;
&lt;br /&gt;
 # convert to vector points&lt;br /&gt;
 r.to.vect -z feature=point in=${BASEMAP}_Data out=${BASEMAP}_pt&lt;br /&gt;
 &lt;br /&gt;
 # interpolate using a regularized spline fit&lt;br /&gt;
 # this is very slow, but produces very high quality output&lt;br /&gt;
 v.surf.rst layer=0 in=${BASEMAP}_pt elev=${BASEMAP}.rst&lt;br /&gt;
 &lt;br /&gt;
 # create 5m buffer area around original data points&lt;br /&gt;
 r.buffer in=${BASEMAP}_Data out=${BASEMAP}.5m_buff dist=5&lt;br /&gt;
 &lt;br /&gt;
 # crop interpolated DEM to only include areas nearby actual data&lt;br /&gt;
 r.mapcalc &amp;quot;${BASEMAP}.filled = \&lt;br /&gt;
    if( isnull(${BASEMAP}.5m_buff), null(), ${BASEMAP}.rst)&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 # set colors to something nice&lt;br /&gt;
 r.colors ${BASEMAP}.filled color=bcyr -e&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Depending on your needs, {{cmd|r.fillnulls}}, {{cmd|v.surf.bspline}}, {{cmd|v.surf.idw}}, {{cmd|r.surf.idw}}, {{cmd|r.surf.idw2}}, or [[GRASS_AddOns#r.surf.nnbathy|r.surf.nnbathy]] may be faster than the {{cmd|v.surf.rst}} method.&lt;br /&gt;
&lt;br /&gt;
=== Visualize raster DEM in 3D ===&lt;br /&gt;
&lt;br /&gt;
 nviz ${BASEMAP}.filled&lt;br /&gt;
&lt;br /&gt;
* Set z-exag to 2.0&lt;br /&gt;
* In Visualize &amp;amp;rarr; Raster Surfaces set the fine (final) resolution to 1, and coarse (preview) resolution to 5.&lt;br /&gt;
* Set the height to 500.0, the perspective to 15.0, and drag the view-puck to the North-West and reasonably zoomed in.&lt;br /&gt;
: You should now be able to see the serpent:&lt;br /&gt;
&lt;br /&gt;
[[Image:LAS_serpent_nviz.jpg|thumb|center|400px|The Great Serpent Mound, Adams County, Ohio, USA]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
It is possible to show vector points in 3D, but millions of them may make the program run slow. Topology is required ({{cmd|v.build}}). Tick the &amp;quot;3D&amp;quot; box in the Visualize &amp;amp;rarr; Vector points dialog.&lt;br /&gt;
&lt;br /&gt;
=== LAS Export ===&lt;br /&gt;
&lt;br /&gt;
==== Export to LAS ====&lt;br /&gt;
&lt;br /&gt;
This is the reverse of the import step, but using {{cmd|v.out.ascii}} or {{cmd|r.out.xyz}} with ''txt2las''.&lt;br /&gt;
Because the v.out.ascii module exports category number which we are not interested in, we cut it away with the UNIX ''cut'' utility.&lt;br /&gt;
&lt;br /&gt;
 v.out.ascii ${BASEMAP}_pts fs=space | cut -f1-3 -d' ' \&lt;br /&gt;
     &amp;gt; ${BASEMAP}_export.txt&lt;br /&gt;
 &lt;br /&gt;
 txt2las --parse xyz -i ${BASEMAP}_export.txt&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Micro-tutorial for LIDAR data analysis ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Simple analysis of single return data ===&lt;br /&gt;
&lt;br /&gt;
Data source: North Carolina sample data set (Lidar data from 2001, near Raleigh, North Carolina). Download from&lt;br /&gt;
   http://www.grassbook.org/ncexternal/&lt;br /&gt;
   -&amp;gt; File: BE3720079200WC20020829m.txt 3.6M (lidar bare earth points [spm])&lt;br /&gt;
&lt;br /&gt;
Scan input file for spatial extent. The -g flag shows the result in a convenient copy-paste format for {{cmd|g.region}}:&lt;br /&gt;
   r.in.xyz BE3720079200WC20020829m.txt out=dummy -s -g&lt;br /&gt;
&lt;br /&gt;
We use this output to set region, predefine 2m raster cells, and polish the odd coordinates with -a:&lt;br /&gt;
   g.region n=222504.439000 s=219456.442000 e=640081.274000 w=637033.274000 res=2 -a -p&lt;br /&gt;
&lt;br /&gt;
==== QUESTION 1: Are these Lidar data sufficiently dense? ====&lt;br /&gt;
&lt;br /&gt;
We compute a raster map representing number of points per cell&lt;br /&gt;
   r.in.xyz BE3720079200WC20020829m.txt out=lid_792_binn2m method=n&lt;br /&gt;
&lt;br /&gt;
Look at the resulting raster map:&lt;br /&gt;
   d.mon x0&lt;br /&gt;
   d.font Vera&lt;br /&gt;
   d.rast.leg lid_792_binn2m&lt;br /&gt;
&lt;br /&gt;
Report point distribution in percent:&lt;br /&gt;
   r.report lid_792_binn2m unit=p&lt;br /&gt;
&lt;br /&gt;
Reduce the resolution to 6m to get at least one point per cell:&lt;br /&gt;
   g.region res=6 -a -p&lt;br /&gt;
   r.in.xyz BE3720079200WC20020829m.txt out=lid_792_binn6m method=n&lt;br /&gt;
   d.rast.leg lid_792_binn6m&lt;br /&gt;
   # ... a few holes remain but that's probably acceptable.&lt;br /&gt;
&lt;br /&gt;
Compute raster maps representing mean elevation for each cell:&lt;br /&gt;
   r.in.xyz BE3720079200WC20020829m.txt out=lid_792_binmean6m  \&lt;br /&gt;
            meth=mean&lt;br /&gt;
   d.rast.leg lid_792_binmean6m&lt;br /&gt;
&lt;br /&gt;
Compute range and variation:&lt;br /&gt;
   r.in.xyz BE3720079200WC20020829m.txt out=lid_792_binrange6m \&lt;br /&gt;
            meth=range&lt;br /&gt;
   d.rast.leg lid_792_binrange6m&lt;br /&gt;
   r.in.xyz BE3720079200WC20020829m.txt out=lid_792_binvar6m   \&lt;br /&gt;
            meth=coeff_var&lt;br /&gt;
   d.rast.leg lid_792_binvar6m&lt;br /&gt;
&lt;br /&gt;
Overlay other GIS maps to map of mean elevation:&lt;br /&gt;
   d.rast.leg lid_792_binmean6m&lt;br /&gt;
   d.vect streets_wake&lt;br /&gt;
   d.vect lakes type=boundary&lt;br /&gt;
   d.vect streams&lt;br /&gt;
&lt;br /&gt;
Now we continue to work in a zoomed spatial subset of the area.&lt;br /&gt;
&lt;br /&gt;
We import only points in the rural area without building topology and using z-coordinate for elevation:&lt;br /&gt;
   g.region rural_1m -p&lt;br /&gt;
   v.in.ascii -ztbr BE3720079200WC20020829m.txt \&lt;br /&gt;
              out=elev_lidrural_bepts z=3&lt;br /&gt;
&lt;br /&gt;
Clear monitor show black-white orthophoto:&lt;br /&gt;
   d.erase -f&lt;br /&gt;
   d.rast ortho_2001_t792_1m&lt;br /&gt;
&lt;br /&gt;
We now use already prepared Lidar vector point maps:&lt;br /&gt;
* elev_lid792_bepts:   Rural area (in tile 792), bare earth lidar point cloud&lt;br /&gt;
* elev_lidrural_mrpts: Rural area multiple return lidar point cloud&lt;br /&gt;
&lt;br /&gt;
Look at ground data:&lt;br /&gt;
d.vect elev_lidrural_bepts siz=2 col=red&lt;br /&gt;
&lt;br /&gt;
Look at &amp;quot;surface&amp;quot; data:&lt;br /&gt;
d.vect elev_lidrural_mrpts siz=1 col=green&lt;br /&gt;
&lt;br /&gt;
Visualize 3D Lidar multi-return points:&lt;br /&gt;
nviz elev_lid792_1m point=elev_lidrural_mrpts&lt;br /&gt;
 # Visualize -&amp;gt; Vector Points -&amp;gt; 3D points&lt;br /&gt;
 #                            -&amp;gt; Icon size 2.25&lt;br /&gt;
 #  --&amp;gt; GRASS book p. 253, fig. 3.15 (see also screenshot [http://www.grassbook.org/about_menu3rd.php here])&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== DEM/DSM separation the simple way by selection of Lidar returns ====&lt;br /&gt;
&lt;br /&gt;
Find out where we have multiple returns:&lt;br /&gt;
   d.rast ortho_2001_t792_1m&lt;br /&gt;
   d.vect elev_lidrural_mrpts where=&amp;quot;return=1&amp;quot; col=red siz=2&lt;br /&gt;
   d.vect elev_lidrural_mrpts where=&amp;quot;return=2&amp;quot; col=green siz=3&lt;br /&gt;
   d.vect elev_lidrural_mrpts where=&amp;quot;return=3&amp;quot; col=blue&lt;br /&gt;
   d.vect elev_lidrural_mrpts where=&amp;quot;return=4&amp;quot; col=yellow&lt;br /&gt;
&lt;br /&gt;
DTM: extract last return(s):&lt;br /&gt;
   v.extract elev_lidrural_mrpts out=elev_lidrural_mrpts_first where=&amp;quot;Return &amp;lt; 2&amp;quot;&lt;br /&gt;
   nviz elev_lid792_1m point=elev_lidrural_mrpts_first&lt;br /&gt;
&lt;br /&gt;
Interpolate to map and look at it:&lt;br /&gt;
   v.surf.rst elev_lidrural_mrpts_first layer=0 elev=elev_lidrural_mrpts_DTM&lt;br /&gt;
   nviz elev_lidrural_mrpts_DTM col=ortho_2001_t792_1m&lt;br /&gt;
&lt;br /&gt;
DSM: extract first return(s):&lt;br /&gt;
   v.extract elev_lidrural_mrpts out=elev_lidrural_mrpts_last where=&amp;quot;Return &amp;gt; 2&amp;quot;&lt;br /&gt;
   nviz elev_lid792_1m point=elev_lidrural_mrpts_last&lt;br /&gt;
&lt;br /&gt;
Interpolate to map and look at it:&lt;br /&gt;
   v.surf.rst elev_lidrural_mrpts_first layer=0 elev=elev_lidrural_mrpts_DSM&lt;br /&gt;
   nviz elev_lidrural_mrpts_DSM col=ortho_2001_t792_1m&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== DEM/DSM separation the more complex way ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;''TODO: verify order of first and last returns in below text''&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
General procedure:&lt;br /&gt;
* Lidar point clouds (first and last return) are imported with {{cmd|v.in.ascii}} (-b flag to not build the topology).&lt;br /&gt;
* Outlier detection is done with {{cmd|v.outlier}} on both first and last return data (NB currently a selection of &amp;lt;/=4 for soe/son in {{cmd|v.outlier}} results in an error message).&lt;br /&gt;
* Then, with {{cmd|v.lidar.edgedetection}}, edges are detected from last return data.&lt;br /&gt;
* The building are generated by {{cmd|v.lidar.growing}} from detected edges.&lt;br /&gt;
* The resulting data are post-processed with {{cmd|v.lidar.correction}}.&lt;br /&gt;
* Finally, the DTM and DSM are generated with {{cmd|v.surf.bspline}} (DTM: uses the 'v.lidar.correction' output; DSM: uses last return output from outlier detection).&lt;br /&gt;
* NB for {{cmd|v.outlier}}, {{cmd|v.lidar.edgedetection}} and {{cmd|v.surf.bspline}}, one spline steps equates to 1m. It is recommended as a starting point that the choice of spline step is roughly 3 or 4 times the planimetric resolution (potential grid resolution) of your data. Experiment from there to obtain better results.&lt;br /&gt;
&lt;br /&gt;
  export GRASS_OVERWRITE=1&lt;br /&gt;
  v.extract elev_lidrural_mrpts out=elev_lidfirst_pts \&lt;br /&gt;
            where=&amp;quot;return = 1&amp;quot;&lt;br /&gt;
  v.extract elev_lidrural_mrpts out=elev_lidlast_pts  \&lt;br /&gt;
            where=&amp;quot;return &amp;gt;= 2&amp;quot;&lt;br /&gt;
  d.vect elev_lidfirst_pts col=red&lt;br /&gt;
  d.vect elev_lidlast_pts col=green&lt;br /&gt;
&lt;br /&gt;
Outlier detection and separation into two maps&lt;br /&gt;
  # 1st return&lt;br /&gt;
  v.outlier elev_lidfirst_pts output=elev_lidfirst_clean \&lt;br /&gt;
            outlier=elev_lidfirst_outl&lt;br /&gt;
  d.erase&lt;br /&gt;
  d.vect elev_lidfirst_clean siz=2&lt;br /&gt;
  d.vect elev_lidfirst_outl col=red&lt;br /&gt;
&lt;br /&gt;
2nd return&lt;br /&gt;
  v.outlier elev_lidlast_pts output=elev_lidlast_clean \&lt;br /&gt;
            outlier=elev_lidlast_outl&lt;br /&gt;
  d.erase&lt;br /&gt;
  d.vect elev_lidlast_clean siz=2&lt;br /&gt;
  d.vect elev_lidlast_outl col=red&lt;br /&gt;
  # -&amp;gt; no outliers visible&lt;br /&gt;
&lt;br /&gt;
Run an edge detection on cleaned last return:&lt;br /&gt;
  v.lidar.edgedetection elev_lidlast_clean \&lt;br /&gt;
                        out=elev_lidlast_edges&lt;br /&gt;
&lt;br /&gt;
Buildings/vegetation are generated from detected edges (bug: you may need to specify the mapset):&lt;br /&gt;
  v.lidar.growing elev_lidlast_edges@lidar out=elev_lidlast_grow \&lt;br /&gt;
                  first=elev_lidfirst_clean&lt;br /&gt;
&lt;br /&gt;
Compare:&lt;br /&gt;
  d.vect elev_lidlast_pts col=blue&lt;br /&gt;
  d.vect elev_lidlast_grow col=green&lt;br /&gt;
&lt;br /&gt;
Correction (this is applied twice):&lt;br /&gt;
  v.lidar.correction elev_lidlast_grow out=elev_lidlast_corr1 \&lt;br /&gt;
                     terrain=elev_lidlast_terr1&lt;br /&gt;
  v.lidar.correction elev_lidlast_corr1 out=elev_lid_dsm \&lt;br /&gt;
                     terrain=elev_lid_dtm&lt;br /&gt;
&lt;br /&gt;
DEM and DSM are generated:&lt;br /&gt;
  # Estimation of lambda_i parameter with cross validation (watch for RMS!)&lt;br /&gt;
  # and note use of bicubic for DSM and bilinear for DTM here and below&lt;br /&gt;
  v.surf.bspline -c elev_lid_dsm sie=100 sin=100 type=bicubic&lt;br /&gt;
  v.surf.bspline -c elev_lid_dtm sie=100 sin=100 type=bilinear&lt;br /&gt;
  &lt;br /&gt;
  # From the cross-validation, we select lambda with minimal RMS error:&lt;br /&gt;
  # generate raster surfaces at 1m resolution &lt;br /&gt;
  v.surf.bspline elev_lid_dsm raster=lidar_dsm lambda=0.1 type=bicubic&lt;br /&gt;
  v.surf.bspline elev_lid_dtm raster=lidar_dtm lambda=0.0001 type=bilinear&lt;br /&gt;
  &lt;br /&gt;
  d.rast lidar_dsm&lt;br /&gt;
  d.rast lidar_dtm&lt;br /&gt;
  &lt;br /&gt;
  nviz lidar_dsm,lidar_dtm \&lt;br /&gt;
       col=ortho_2001_t792_1m,ortho_2001_t792_1m&lt;br /&gt;
&lt;br /&gt;
...with the position slider you can visually separate DSM and DEM, increase z slider (Visualize -&amp;gt; Raster Surface -&amp;gt; Position).&lt;br /&gt;
&lt;br /&gt;
== Sample LIDAR data ==&lt;br /&gt;
&lt;br /&gt;
=== Widely used in GRASS tutorials ===&lt;br /&gt;
&lt;br /&gt;
* [http://www.grassbook.org/data_menu2nd.php Jockey's Ridge, NC, LIDAR dataset]&lt;br /&gt;
* [http://www.grassbook.org/data_menu3rd.php North Carolina OSGeo Edu data set] (includes multi-return LIDAR data)&lt;br /&gt;
&lt;br /&gt;
=== Other ===&lt;br /&gt;
&lt;br /&gt;
* United States Antarctic Resource Center: LIDAR High-resolution DEM Final DATA Downloads&amp;lt;BR&amp;gt;http://usarc.usgs.gov/lidar_dload.shtml&lt;br /&gt;
&lt;br /&gt;
* LIDAR ALSM Research, Arizona State University Ative Tectonics, Research Group&amp;lt;BR&amp;gt;  http://lidar.asu.edu/research.html and http://www.geongrid.org/science/lidar.html&lt;br /&gt;
&lt;br /&gt;
* USGS Center for LIDAR Information Coordination and Knowledge (aka CLICK) - USGS LiDAR point cloud distribution site&amp;lt;BR&amp;gt; http://lidar.cr.usgs.gov&lt;br /&gt;
&lt;br /&gt;
* Washington State Geospatial Data Archive, Mount Saint Helens - Lidar Data &amp;lt;BR&amp;gt;https://wagda.lib.washington.edu/data/type/elevation/lidar/st_helens/&lt;br /&gt;
&lt;br /&gt;
* Puget Sound Lidar Consortium, public-domain high-resolution topography for western Washington&amp;lt;BR&amp;gt;http://pugetsoundlidar.ess.washington.edu/index.htm&lt;br /&gt;
&lt;br /&gt;
* NOAA Topographic Change Mapping LIDAR Data Retrieval Tool (LDART) NOAA Coastal Services Center&amp;lt;BR&amp;gt;http://maps.csc.noaa.gov/TCM/&lt;br /&gt;
&lt;br /&gt;
* Landmap, LIDAR Data from the Environment Agency &amp;lt;BR&amp;gt;http://www.landmap.ac.uk/lidar/lidar.html&lt;br /&gt;
&lt;br /&gt;
* Northern California LIDAR data &amp;lt;BR&amp;gt;http://quake.usgs.gov/research/geology/lidar/  and http://core2.gsfc.nasa.gov/lidar/terrapoint/&lt;br /&gt;
&lt;br /&gt;
* IDAHO GEOSPATIAL , Bare Earth LIDAR DEM Download - UTM &amp;lt;BR&amp;gt;http://inside.uidaho.edu/geodata/LiDAR/LiDARBareEarthDEM_DownloadUTM.htm&lt;br /&gt;
&lt;br /&gt;
* EarthScope Spatial Data Explorer - A java application for querying, browsing, and acquiring data from the EarthScope Spatial Data Repository. Currently includes a number of LiDAR datasets. &amp;lt;BR&amp;gt;http://www.earthscope.org/data/lidar.php&lt;br /&gt;
&lt;br /&gt;
* LIDAR Galley &amp;lt;BR&amp;gt;https://peoiewswebinfo.monmouth.army.mil/JPSD/LIDAR_Gallery.htm&lt;br /&gt;
&lt;br /&gt;
* South Tyrol - Download of DTMs (Homepage in German or Italian) &amp;lt;BR&amp;gt; http://www.provinz.bz.it/raumordnung/grundkarten/utm/default_d.htm&lt;br /&gt;
&lt;br /&gt;
== Links ==&lt;br /&gt;
&lt;br /&gt;
* [http://liblas.org/ libLAS] - LAS 1.0/1.1 ASPRS LiDAR data translation toolset&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>⚠️John Tate</name></author>
	</entry>
	<entry>
		<id>https://grasswiki.osgeo.org/w/index.php?title=LIDAR&amp;diff=10081</id>
		<title>LIDAR</title>
		<link rel="alternate" type="text/html" href="https://grasswiki.osgeo.org/w/index.php?title=LIDAR&amp;diff=10081"/>
		<updated>2010-01-07T10:18:38Z</updated>

		<summary type="html">&lt;p&gt;⚠️John Tate: /* DEM/DSM separation the more complex way */ very minor edit&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;h1&amp;gt; LIDAR and Multi-beam Swath bathymetry data &amp;lt;/h1&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Modules ==&lt;br /&gt;
&lt;br /&gt;
=== Import ===&lt;br /&gt;
&lt;br /&gt;
* {{cmd|r.in.xyz}} - Create a raster map from an assemblage of many coordinates using univariate statistics. ([http://hamish.bowman.googlepages.com/grassfiles#xyz example])&lt;br /&gt;
&lt;br /&gt;
* {{cmd|v.in.ascii}} - Import data from an ASCII file to GRASS vector format.&lt;br /&gt;
: ''Due to memory overhead vector point imports will be limited to a few million data points unless topology and database creation is skipped with the '''-bt''' flags''. It may also be useful to clip the import file to only accept points falling within the current region by using the '''-r''' flag. See {{cmd|g.region}} for details on specifying the region bounds.&lt;br /&gt;
&lt;br /&gt;
=== Analysis ===&lt;br /&gt;
&lt;br /&gt;
* {{cmd|v.outlier}} - Removes outliers from vector point data.&lt;br /&gt;
&lt;br /&gt;
* {{cmd|v.lidar.edgedetection}} - Detect the object's edges from a LIDAR data set.&lt;br /&gt;
&lt;br /&gt;
* {{cmd|v.lidar.growing}} - Building contour determination and Region Growing algorithm for determining the building inside.&lt;br /&gt;
&lt;br /&gt;
* {{cmd|v.lidar.correction}} - Correction of the v.lidar.growing output. It is the last of the three algorithms for LIDAR filtering.&lt;br /&gt;
&lt;br /&gt;
=== Surface generation ===&lt;br /&gt;
&lt;br /&gt;
* {{cmd|v.surf.rst}} - Spatial approximation and topographic analysis using regularized spline with tension.&lt;br /&gt;
&lt;br /&gt;
* {{cmd|v.surf.idw}} - Surface interpolation from vector point data by Inverse Distance Squared Weighting.&lt;br /&gt;
&lt;br /&gt;
* {{cmd|v.surf.bspline}} - Surface interpolation from vector point data by bicubic or bilineal interpolation with Tykhonov regularization.&lt;br /&gt;
&lt;br /&gt;
* {{cmd|r.fillnulls}} - Fills no-data areas in raster maps using v.surf.rst splines interpolation.&lt;br /&gt;
&lt;br /&gt;
== Swath Bathymetry Tools ==&lt;br /&gt;
&lt;br /&gt;
''see also the [[Marine_Science#Multibeam_sonar_processing]] wiki page''&lt;br /&gt;
&lt;br /&gt;
* The [http://david.p.finlayson.googlepages.com/swathwidth v.swathwidith] module by David Finlayson for planning surveys. (development page)&lt;br /&gt;
&lt;br /&gt;
* An example of [http://bambi.otago.ac.nz/hamish/grass/gdal/sidescan_warp.html post-processing scanned paper sidescan swaths] using thin plate spline warping with [http://www.gdal.org/ GDAL's] &amp;quot;&amp;lt;tt&amp;gt;gdalwarp -tps&amp;lt;/tt&amp;gt;&amp;quot; function. (debugging page)&lt;br /&gt;
&lt;br /&gt;
* [[MB-System|GRASS integration]] with [http://www.ldeo.columbia.edu/res/pi/MB-System/ MB-System] (GPL) software for processing Multibeam and Sidescan Sonar data. GRASS + [[MB-System|MBsys]] + [[GMT]] make a nice scriptable trio.&lt;br /&gt;
&lt;br /&gt;
== LIDAR Tools ==&lt;br /&gt;
&lt;br /&gt;
*  {{cmd|r.terraflow}} - computation of flow direction, flow accumulation and other basic topographic terrain indices from massive raster digital elevation models (DEM). From the Duke University [http://terrain.cs.duke.edu/ STREAM] project.&lt;br /&gt;
&lt;br /&gt;
* [http://mpa.itc.it/markus/grass61/demos/rlake/ Flood simulation] using {{cmd|r.lake}}. Includes fancy NVIZ visualization of Trento, Italy, by Markus Neteler.&lt;br /&gt;
&lt;br /&gt;
* [http://www.cs.unc.edu/~isenburg/software/ LAStools] are a set of simple command line tools  (including source code) for converting to/from ASCII, viewing, comparing, and compressing LIDAR data.&lt;br /&gt;
&lt;br /&gt;
* [http://www.liblas.org libLAS] ASPRS LiDAR data translation tools&lt;br /&gt;
&lt;br /&gt;
* See also [[LIDAR#Analysis|LIDAR Analysis]]&lt;br /&gt;
&lt;br /&gt;
== Micro-tutorial for LAS data==&lt;br /&gt;
&lt;br /&gt;
=== Preparation ===&lt;br /&gt;
&lt;br /&gt;
==== Conversion of text files to LAS ====&lt;br /&gt;
&lt;br /&gt;
[http://www.liblas.org/ libLAS] supports the following column types:&lt;br /&gt;
   x - x coordinate&lt;br /&gt;
   y - y coordinate&lt;br /&gt;
   z - z coordinate&lt;br /&gt;
   a - scan angle&lt;br /&gt;
   i - intensity&lt;br /&gt;
   n - number of returns for given pulse (1..n)&lt;br /&gt;
   r - number of this return (1..r)&lt;br /&gt;
   c - classification&lt;br /&gt;
   u - user data (but only 1 byte)&lt;br /&gt;
   p - point source ID&lt;br /&gt;
   e - edge of flight line&lt;br /&gt;
   d - direction of scan flag&lt;br /&gt;
   t - GPS time&lt;br /&gt;
   s - skip column&lt;br /&gt;
&lt;br /&gt;
Sample text data such as:&lt;br /&gt;
   returntime,pulse,east,north,height,intensity,stripe&lt;br /&gt;
   549778.907200,1,673999.940,5099680.080,507.425,20.0,45105&lt;br /&gt;
   ...&lt;br /&gt;
&lt;br /&gt;
can be converted to LAS format like this:&lt;br /&gt;
   returntime - t&lt;br /&gt;
   pulse - r&lt;br /&gt;
   east - x&lt;br /&gt;
   north - y&lt;br /&gt;
   height - z&lt;br /&gt;
   intensity - i&lt;br /&gt;
   stripe - s&lt;br /&gt;
&lt;br /&gt;
First parse (sanity check):&lt;br /&gt;
   txt2las -parse trxyzis data.asc&lt;br /&gt;
&lt;br /&gt;
Then convert:&lt;br /&gt;
   txt2las -parse trxyzis -i data.asc -o data.las &lt;br /&gt;
&lt;br /&gt;
While you may not need to do this conversion for GRASS import, the resulting files are way smaller than the uncompressed text files; additionally, they are in a defined format.&lt;br /&gt;
&lt;br /&gt;
=== LAS Import ===&lt;br /&gt;
&lt;br /&gt;
* Use the [http://www.liblas.org libLAS] utilities to import LAS data into GRASS. &lt;br /&gt;
* Data stored in text files can generally be imported directly into GRASS.&lt;br /&gt;
&lt;br /&gt;
* The data used in the rest of this micro-tutorial can be found at [http://www.appliedimagery.com/Serpent%20Mound%20Model%20LAS%20Data.las appliedimagery.com].&lt;br /&gt;
&lt;br /&gt;
==== Import LAS as raster DEM ====&lt;br /&gt;
&lt;br /&gt;
Check bounds and SRS:&lt;br /&gt;
 $ lasinfo &amp;quot;Serpent_Mound_Model_LAS_Data.las&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
  [...]&lt;br /&gt;
  Min X Y Z                  289020.900000 4320942.610000 166.780000&lt;br /&gt;
  Max X Y Z                  290106.020000 4323641.570000 215.480000&lt;br /&gt;
 Spatial Reference           +proj=utm +zone=17 +ellps=WGS84 +units=m &lt;br /&gt;
&lt;br /&gt;
After creating a suitable UTM zone 17 location (EPSG:32617) &lt;br /&gt;
set the region according to the information from lasinfo at 1m resolution, rounding grid outwards to align to whole meters:&lt;br /&gt;
 GRASS&amp;gt; {{cmd|g.region}} n=4323641.57 s=4320942.61 w=289020.90 e=290106.02 res=1 -ap&lt;br /&gt;
&lt;br /&gt;
Finally, import with {{cmd|r.in.xyz}} with data piped directly from the &amp;lt;tt&amp;gt;las2txt&amp;lt;/tt&amp;gt; program and set a nice equalized color table:&lt;br /&gt;
 BASEMAP=&amp;quot;Serpent_Mound_Model_LAS&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 las2txt --stdout &amp;quot;${BASEMAP}_Data.las&amp;quot; | \&lt;br /&gt;
    r.in.xyz in=- out=${BASEMAP}_Data fs=space method=mean&lt;br /&gt;
 &lt;br /&gt;
 {{cmd|r.colors}} ${BASEMAP}_Data color=bcyr -e&lt;br /&gt;
&lt;br /&gt;
The above example uses the default z-elevation level as the 3rd term, but by using the &amp;lt;tt&amp;gt;las2txt --parse&amp;lt;/tt&amp;gt; command other fields (such as intensity) can be imported instead via &amp;quot;&amp;lt;tt&amp;gt;--parse xyi&amp;lt;/tt&amp;gt;&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
==== Import LAS as vector points ====&lt;br /&gt;
&lt;br /&gt;
Region setting (establishing the grid) is not needed for vector features so we can go directly to the import step. To deal with millions of input points {{cmd|v.in.ascii}} should be run with the options to skip creation of an attribute database and building topology as these can consume large amounts of memory. Note that vector maps without topology built are somewhat limited in their ability to be processed. Most LIDAR specific modules have been adapted to not require &lt;br /&gt;
topology. Even so, after initial cleaning steps it is often more efficient to work with huge datasets in GRASS as raster data.&lt;br /&gt;
&lt;br /&gt;
 las2txt --stdout &amp;quot;${BASEMAP}_Data.las&amp;quot; | \&lt;br /&gt;
   v.in.ascii -tbz z=3 out=&amp;quot;${BASEMAP}_pts&amp;quot; fs=space&lt;br /&gt;
&lt;br /&gt;
If topology was built, you can use {{cmd|d.vect}}'s -z flag to colorize by elevation value. Without topology you can still colorize, but you need to use color rules based on absolute elevations, not percentage of scale.&lt;br /&gt;
&amp;lt;!-- need an absolute color map gradiated across the elev range --&amp;gt;&lt;br /&gt;
 # display colorized points for data with built topology&lt;br /&gt;
 d.vect map=lidar_pts size=1 -z zcolor=elevation&lt;br /&gt;
&lt;br /&gt;
* After import as points you can then use the v.lidar tools to clean the data: {{cmd|v.lidar.correction}}, {{cmd|v.lidar.edgedetection}}, {{cmd|v.lidar.growing}}, and {{cmd|v.outlier}}.&lt;br /&gt;
&lt;br /&gt;
* Vector points can be interpolated into raster DEMs with a number of modules, including {{cmd|v.surf.rst}}, {{cmd|v.surf.bspline}}, and {{cmd|v.surf.idw}}.&lt;br /&gt;
&lt;br /&gt;
=== Clean imported raster DEM ===&lt;br /&gt;
&lt;br /&gt;
(fill holes)&lt;br /&gt;
&lt;br /&gt;
 # convert to vector points&lt;br /&gt;
 r.to.vect -z feature=point in=${BASEMAP}_Data out=${BASEMAP}_pt&lt;br /&gt;
 &lt;br /&gt;
 # interpolate using a regularized spline fit&lt;br /&gt;
 # this is very slow, but produces very high quality output&lt;br /&gt;
 v.surf.rst layer=0 in=${BASEMAP}_pt elev=${BASEMAP}.rst&lt;br /&gt;
 &lt;br /&gt;
 # create 5m buffer area around original data points&lt;br /&gt;
 r.buffer in=${BASEMAP}_Data out=${BASEMAP}.5m_buff dist=5&lt;br /&gt;
 &lt;br /&gt;
 # crop interpolated DEM to only include areas nearby actual data&lt;br /&gt;
 r.mapcalc &amp;quot;${BASEMAP}.filled = \&lt;br /&gt;
    if( isnull(${BASEMAP}.5m_buff), null(), ${BASEMAP}.rst)&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 # set colors to something nice&lt;br /&gt;
 r.colors ${BASEMAP}.filled color=bcyr -e&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Depending on your needs, {{cmd|r.fillnulls}}, {{cmd|v.surf.bspline}}, {{cmd|v.surf.idw}}, {{cmd|r.surf.idw}}, {{cmd|r.surf.idw2}}, or [[GRASS_AddOns#r.surf.nnbathy|r.surf.nnbathy]] may be faster than the {{cmd|v.surf.rst}} method.&lt;br /&gt;
&lt;br /&gt;
=== Visualize raster DEM in 3D ===&lt;br /&gt;
&lt;br /&gt;
 nviz ${BASEMAP}.filled&lt;br /&gt;
&lt;br /&gt;
* Set z-exag to 2.0&lt;br /&gt;
* In Visualize &amp;amp;rarr; Raster Surfaces set the fine (final) resolution to 1, and coarse (preview) resolution to 5.&lt;br /&gt;
* Set the height to 500.0, the perspective to 15.0, and drag the view-puck to the North-West and reasonably zoomed in.&lt;br /&gt;
: You should now be able to see the serpent:&lt;br /&gt;
&lt;br /&gt;
[[Image:LAS_serpent_nviz.jpg|thumb|center|400px|The Great Serpent Mound, Adams County, Ohio, USA]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
It is possible to show vector points in 3D, but millions of them may make the program run slow. Topology is required ({{cmd|v.build}}). Tick the &amp;quot;3D&amp;quot; box in the Visualize &amp;amp;rarr; Vector points dialog.&lt;br /&gt;
&lt;br /&gt;
=== LAS Export ===&lt;br /&gt;
&lt;br /&gt;
==== Export to LAS ====&lt;br /&gt;
&lt;br /&gt;
This is the reverse of the import step, but using {{cmd|v.out.ascii}} or {{cmd|r.out.xyz}} with ''txt2las''.&lt;br /&gt;
Because the v.out.ascii module exports category number which we are not interested in, we cut it away with the UNIX ''cut'' utility.&lt;br /&gt;
&lt;br /&gt;
 v.out.ascii ${BASEMAP}_pts fs=space | cut -f1-3 -d' ' \&lt;br /&gt;
     &amp;gt; ${BASEMAP}_export.txt&lt;br /&gt;
 &lt;br /&gt;
 txt2las --parse xyz -i ${BASEMAP}_export.txt&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Micro-tutorial for LIDAR data analysis ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Simple analysis of single return data ===&lt;br /&gt;
&lt;br /&gt;
Data source: North Carolina sample data set (Lidar data from 2001, near Raleigh, North Carolina). Download from&lt;br /&gt;
   http://www.grassbook.org/ncexternal/&lt;br /&gt;
   -&amp;gt; File: BE3720079200WC20020829m.txt 3.6M (lidar bare earth points [spm])&lt;br /&gt;
&lt;br /&gt;
Scan input file for spatial extent. The -g flag shows the result in a convenient copy-paste format for {{cmd|g.region}}:&lt;br /&gt;
   r.in.xyz BE3720079200WC20020829m.txt out=dummy -s -g&lt;br /&gt;
&lt;br /&gt;
We use this output to set region, predefine 2m raster cells, and polish the odd coordinates with -a:&lt;br /&gt;
   g.region n=222504.439000 s=219456.442000 e=640081.274000 w=637033.274000 res=2 -a -p&lt;br /&gt;
&lt;br /&gt;
==== QUESTION 1: Are these Lidar data sufficiently dense? ====&lt;br /&gt;
&lt;br /&gt;
We compute a raster map representing number of points per cell&lt;br /&gt;
   r.in.xyz BE3720079200WC20020829m.txt out=lid_792_binn2m method=n&lt;br /&gt;
&lt;br /&gt;
Look at the resulting raster map:&lt;br /&gt;
   d.mon x0&lt;br /&gt;
   d.font Vera&lt;br /&gt;
   d.rast.leg lid_792_binn2m&lt;br /&gt;
&lt;br /&gt;
Report point distribution in percent:&lt;br /&gt;
   r.report lid_792_binn2m unit=p&lt;br /&gt;
&lt;br /&gt;
Reduce the resolution to 6m to get at least one point per cell:&lt;br /&gt;
   g.region res=6 -a -p&lt;br /&gt;
   r.in.xyz BE3720079200WC20020829m.txt out=lid_792_binn6m method=n&lt;br /&gt;
   d.rast.leg lid_792_binn6m&lt;br /&gt;
   # ... a few holes remain but that's probably acceptable.&lt;br /&gt;
&lt;br /&gt;
Compute raster maps representing mean elevation for each cell:&lt;br /&gt;
   r.in.xyz BE3720079200WC20020829m.txt out=lid_792_binmean6m  \&lt;br /&gt;
            meth=mean&lt;br /&gt;
   d.rast.leg lid_792_binmean6m&lt;br /&gt;
&lt;br /&gt;
Compute range and variation:&lt;br /&gt;
   r.in.xyz BE3720079200WC20020829m.txt out=lid_792_binrange6m \&lt;br /&gt;
            meth=range&lt;br /&gt;
   d.rast.leg lid_792_binrange6m&lt;br /&gt;
   r.in.xyz BE3720079200WC20020829m.txt out=lid_792_binvar6m   \&lt;br /&gt;
            meth=coeff_var&lt;br /&gt;
   d.rast.leg lid_792_binvar6m&lt;br /&gt;
&lt;br /&gt;
Overlay other GIS maps to map of mean elevation:&lt;br /&gt;
   d.rast.leg lid_792_binmean6m&lt;br /&gt;
   d.vect streets_wake&lt;br /&gt;
   d.vect lakes type=boundary&lt;br /&gt;
   d.vect streams&lt;br /&gt;
&lt;br /&gt;
Now we continue to work in a zoomed spatial subset of the area.&lt;br /&gt;
&lt;br /&gt;
We import only points in the rural area without building topology and using z-coordinate for elevation:&lt;br /&gt;
   g.region rural_1m -p&lt;br /&gt;
   v.in.ascii -ztbr BE3720079200WC20020829m.txt \&lt;br /&gt;
              out=elev_lidrural_bepts z=3&lt;br /&gt;
&lt;br /&gt;
Clear monitor show black-white orthophoto:&lt;br /&gt;
   d.erase -f&lt;br /&gt;
   d.rast ortho_2001_t792_1m&lt;br /&gt;
&lt;br /&gt;
We now use already prepared Lidar vector point maps:&lt;br /&gt;
* elev_lid792_bepts:   Rural area (in tile 792), bare earth lidar point cloud&lt;br /&gt;
* elev_lidrural_mrpts: Rural area multiple return lidar point cloud&lt;br /&gt;
&lt;br /&gt;
Look at ground data:&lt;br /&gt;
d.vect elev_lidrural_bepts siz=2 col=red&lt;br /&gt;
&lt;br /&gt;
Look at &amp;quot;surface&amp;quot; data:&lt;br /&gt;
d.vect elev_lidrural_mrpts siz=1 col=green&lt;br /&gt;
&lt;br /&gt;
Visualize 3D Lidar multi-return points:&lt;br /&gt;
nviz elev_lid792_1m point=elev_lidrural_mrpts&lt;br /&gt;
 # Visualize -&amp;gt; Vector Points -&amp;gt; 3D points&lt;br /&gt;
 #                            -&amp;gt; Icon size 2.25&lt;br /&gt;
 #  --&amp;gt; GRASS book p. 253, fig. 3.15 (see also screenshot [http://www.grassbook.org/about_menu3rd.php here])&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== DEM/DSM separation the simple way by selection of Lidar returns ====&lt;br /&gt;
&lt;br /&gt;
Find out where we have multiple returns:&lt;br /&gt;
   d.rast ortho_2001_t792_1m&lt;br /&gt;
   d.vect elev_lidrural_mrpts where=&amp;quot;return=1&amp;quot; col=red siz=2&lt;br /&gt;
   d.vect elev_lidrural_mrpts where=&amp;quot;return=2&amp;quot; col=green siz=3&lt;br /&gt;
   d.vect elev_lidrural_mrpts where=&amp;quot;return=3&amp;quot; col=blue&lt;br /&gt;
   d.vect elev_lidrural_mrpts where=&amp;quot;return=4&amp;quot; col=yellow&lt;br /&gt;
&lt;br /&gt;
DTM: extract last return(s):&lt;br /&gt;
   v.extract elev_lidrural_mrpts out=elev_lidrural_mrpts_first where=&amp;quot;Return &amp;lt; 2&amp;quot;&lt;br /&gt;
   nviz elev_lid792_1m point=elev_lidrural_mrpts_first&lt;br /&gt;
&lt;br /&gt;
Interpolate to map and look at it:&lt;br /&gt;
   v.surf.rst elev_lidrural_mrpts_first layer=0 elev=elev_lidrural_mrpts_DTM&lt;br /&gt;
   nviz elev_lidrural_mrpts_DTM col=ortho_2001_t792_1m&lt;br /&gt;
&lt;br /&gt;
DSM: extract first return(s):&lt;br /&gt;
   v.extract elev_lidrural_mrpts out=elev_lidrural_mrpts_last where=&amp;quot;Return &amp;gt; 2&amp;quot;&lt;br /&gt;
   nviz elev_lid792_1m point=elev_lidrural_mrpts_last&lt;br /&gt;
&lt;br /&gt;
Interpolate to map and look at it:&lt;br /&gt;
   v.surf.rst elev_lidrural_mrpts_first layer=0 elev=elev_lidrural_mrpts_DSM&lt;br /&gt;
   nviz elev_lidrural_mrpts_DSM col=ortho_2001_t792_1m&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== DEM/DSM separation the more complex way ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;''TODO: verify order of first and last returns in below text''&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
General procedure:&lt;br /&gt;
* Lidar point clouds (first and last return) are imported with {{cmd|v.in.ascii}} (-b flag to not build the topology).&lt;br /&gt;
* Outlier detection is done with {{cmd|v.outlier}} on both first and last return data (NB currently a selection of &amp;lt;/=4 for soe/son in {{cmd|v.outlier}} results in an error message).&lt;br /&gt;
* Then, with {{cmd|v.lidar.edgedetection}}, edges are detected from last return data.&lt;br /&gt;
* The building are generated by {{cmd|v.lidar.growing}} from detected edges.&lt;br /&gt;
* The resulting data are post-processed with {{cmd|v.lidar.correction}}.&lt;br /&gt;
* Finally, the DTM and DSM are generated with {{cmd|v.surf.bspline}} (DTM: uses the 'v.lidar.correction' output; DSM: uses last return output from outlier detection).&lt;br /&gt;
* NB for {{cmd|v.outlier}}, {{cmd|v.lidar.edgedetection}} and {{cmd|v.surf.bspline}}, one spline steps equates to 1m. It is recommended as a starting point that the choice of spline step is roughly 3 or 4 times the planimetric resolution (potential grid resolution) of your data. Experiment from there to obtain better results.&lt;br /&gt;
&lt;br /&gt;
  export GRASS_OVERWRITE=1&lt;br /&gt;
  v.extract elev_lidrural_mrpts out=elev_lidfirst_pts \&lt;br /&gt;
            where=&amp;quot;return = 1&amp;quot;&lt;br /&gt;
  v.extract elev_lidrural_mrpts out=elev_lidlast_pts  \&lt;br /&gt;
            where=&amp;quot;return &amp;gt;= 2&amp;quot;&lt;br /&gt;
  d.vect elev_lidfirst_pts col=red&lt;br /&gt;
  d.vect elev_lidlast_pts col=green&lt;br /&gt;
&lt;br /&gt;
Outlier detection and separation into two maps&lt;br /&gt;
  # 1st return&lt;br /&gt;
  v.outlier elev_lidfirst_pts output=elev_lidfirst_clean \&lt;br /&gt;
            outlier=elev_lidfirst_outl&lt;br /&gt;
  d.erase&lt;br /&gt;
  d.vect elev_lidfirst_clean siz=2&lt;br /&gt;
  d.vect elev_lidfirst_outl col=red&lt;br /&gt;
&lt;br /&gt;
2nd return&lt;br /&gt;
  v.outlier elev_lidlast_pts output=elev_lidlast_clean \&lt;br /&gt;
            outlier=elev_lidlast_outl&lt;br /&gt;
  d.erase&lt;br /&gt;
  d.vect elev_lidlast_clean siz=2&lt;br /&gt;
  d.vect elev_lidlast_outl col=red&lt;br /&gt;
  # -&amp;gt; no outliers visible&lt;br /&gt;
&lt;br /&gt;
Run an edge detection on cleaned last return:&lt;br /&gt;
  v.lidar.edgedetection elev_lidlast_clean \&lt;br /&gt;
                        out=elev_lidlast_edges&lt;br /&gt;
&lt;br /&gt;
Buildings/vegetation are generated from detected edges (bug: you may need to specify the mapset):&lt;br /&gt;
  v.lidar.growing elev_lidlast_edges@lidar out=elev_lidlast_grow \&lt;br /&gt;
                  first=elev_lidfirst_clean&lt;br /&gt;
&lt;br /&gt;
Compare:&lt;br /&gt;
  d.vect elev_lidlast_pts col=blue&lt;br /&gt;
  d.vect elev_lidlast_grow col=green&lt;br /&gt;
&lt;br /&gt;
Correction (this is applied twice):&lt;br /&gt;
  v.lidar.correction elev_lidlast_grow out=elev_lidlast_corr1 \&lt;br /&gt;
                     terrain=elev_lidlast_terr1&lt;br /&gt;
  v.lidar.correction elev_lidlast_corr1 out=elev_lid_dsm \&lt;br /&gt;
                     terrain=elev_lid_dtm&lt;br /&gt;
&lt;br /&gt;
DEM and DSM are generated:&lt;br /&gt;
  # Estimation of lambda_i parameter with cross validation (watch for RMS!)&lt;br /&gt;
  # and note use of bicubic for DSM and bilinear for DTM here and below&lt;br /&gt;
  v.surf.bspline -c elev_lid_dsm sie=100 sin=100 type=bicubic&lt;br /&gt;
  v.surf.bspline -c elev_lid_dtm sie=100 sin=100 type=bilinear&lt;br /&gt;
  &lt;br /&gt;
  # From the cross-validation, we select lambda with minimal RMS error:&lt;br /&gt;
  # generate raster surfaces at 1m resolution &lt;br /&gt;
  v.surf.bspline elev_lid_dsm raster=lidar_dsm lambda=0.1 type=bicubic&lt;br /&gt;
  v.surf.bspline elev_lid_dtm raster=lidar_dtm lambda=0.0001 type=bilinear&lt;br /&gt;
  &lt;br /&gt;
  d.rast lidar_dsm&lt;br /&gt;
  d.rast lidar_dtm&lt;br /&gt;
  &lt;br /&gt;
  nviz lidar_dsm,lidar_dtm \&lt;br /&gt;
       col=ortho_2001_t792_1m,ortho_2001_t792_1m&lt;br /&gt;
&lt;br /&gt;
...with the position slider you can visually separate DSM and DEM, increase z slider (Visualize -&amp;gt; Raster Surface -&amp;gt; Position).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Windows users (6.4.x only?):'''&lt;br /&gt;
* When using the DBF driver (default) it is necessary to manually create the DBF table prior to importing points with {{cmd|v.in.ascii}}:&lt;br /&gt;
  # Manually connect the DBF table&lt;br /&gt;
  db.connect driver=dbf database='$GISDBASE/$LOCATION_NAME/$MAPSET/dbf'&lt;br /&gt;
  &lt;br /&gt;
  # Display the connection (bug: has to be a separate command and run or the connection does not work)&lt;br /&gt;
  db.connect -p&lt;br /&gt;
&lt;br /&gt;
* Bug?: {{cmd|v.in.ascii}} is the only module that requires the mapset to be specified with the input file like with {{cmd|v.lidar.growing}} above.&lt;br /&gt;
&lt;br /&gt;
== Sample LIDAR data ==&lt;br /&gt;
&lt;br /&gt;
=== Widely used in GRASS tutorials ===&lt;br /&gt;
&lt;br /&gt;
* [http://www.grassbook.org/data_menu2nd.php Jockey's Ridge, NC, LIDAR dataset]&lt;br /&gt;
* [http://www.grassbook.org/data_menu3rd.php North Carolina OSGeo Edu data set] (includes multi-return LIDAR data)&lt;br /&gt;
&lt;br /&gt;
=== Other ===&lt;br /&gt;
&lt;br /&gt;
* United States Antarctic Resource Center: LIDAR High-resolution DEM Final DATA Downloads&amp;lt;BR&amp;gt;http://usarc.usgs.gov/lidar_dload.shtml&lt;br /&gt;
&lt;br /&gt;
* LIDAR ALSM Research, Arizona State University Ative Tectonics, Research Group&amp;lt;BR&amp;gt;  http://lidar.asu.edu/research.html and http://www.geongrid.org/science/lidar.html&lt;br /&gt;
&lt;br /&gt;
* USGS Center for LIDAR Information Coordination and Knowledge (aka CLICK) - USGS LiDAR point cloud distribution site&amp;lt;BR&amp;gt; http://lidar.cr.usgs.gov&lt;br /&gt;
&lt;br /&gt;
* Washington State Geospatial Data Archive, Mount Saint Helens - Lidar Data &amp;lt;BR&amp;gt;https://wagda.lib.washington.edu/data/type/elevation/lidar/st_helens/&lt;br /&gt;
&lt;br /&gt;
* Puget Sound Lidar Consortium, public-domain high-resolution topography for western Washington&amp;lt;BR&amp;gt;http://pugetsoundlidar.ess.washington.edu/index.htm&lt;br /&gt;
&lt;br /&gt;
* NOAA Topographic Change Mapping LIDAR Data Retrieval Tool (LDART) NOAA Coastal Services Center&amp;lt;BR&amp;gt;http://maps.csc.noaa.gov/TCM/&lt;br /&gt;
&lt;br /&gt;
* Landmap, LIDAR Data from the Environment Agency &amp;lt;BR&amp;gt;http://www.landmap.ac.uk/lidar/lidar.html&lt;br /&gt;
&lt;br /&gt;
* Northern California LIDAR data &amp;lt;BR&amp;gt;http://quake.usgs.gov/research/geology/lidar/  and http://core2.gsfc.nasa.gov/lidar/terrapoint/&lt;br /&gt;
&lt;br /&gt;
* IDAHO GEOSPATIAL , Bare Earth LIDAR DEM Download - UTM &amp;lt;BR&amp;gt;http://inside.uidaho.edu/geodata/LiDAR/LiDARBareEarthDEM_DownloadUTM.htm&lt;br /&gt;
&lt;br /&gt;
* EarthScope Spatial Data Explorer - A java application for querying, browsing, and acquiring data from the EarthScope Spatial Data Repository. Currently includes a number of LiDAR datasets. &amp;lt;BR&amp;gt;http://www.earthscope.org/data/lidar.php&lt;br /&gt;
&lt;br /&gt;
* LIDAR Galley &amp;lt;BR&amp;gt;https://peoiewswebinfo.monmouth.army.mil/JPSD/LIDAR_Gallery.htm&lt;br /&gt;
&lt;br /&gt;
* South Tyrol - Download of DTMs (Homepage in German or Italian) &amp;lt;BR&amp;gt; http://www.provinz.bz.it/raumordnung/grundkarten/utm/default_d.htm&lt;br /&gt;
&lt;br /&gt;
== Links ==&lt;br /&gt;
&lt;br /&gt;
* [http://liblas.org/ libLAS] - LAS 1.0/1.1 ASPRS LiDAR data translation toolset&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>⚠️John Tate</name></author>
	</entry>
	<entry>
		<id>https://grasswiki.osgeo.org/w/index.php?title=LIDAR&amp;diff=9865</id>
		<title>LIDAR</title>
		<link rel="alternate" type="text/html" href="https://grasswiki.osgeo.org/w/index.php?title=LIDAR&amp;diff=9865"/>
		<updated>2009-11-05T16:52:27Z</updated>

		<summary type="html">&lt;p&gt;⚠️John Tate: /* DEM/DSM separation the more complex way */ added to windows users section&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;h1&amp;gt; LIDAR and Multi-beam Swath bathymetry data &amp;lt;/h1&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Modules ==&lt;br /&gt;
&lt;br /&gt;
=== Import ===&lt;br /&gt;
&lt;br /&gt;
* {{cmd|r.in.xyz}} - Create a raster map from an assemblage of many coordinates using univariate statistics. ([http://hamish.bowman.googlepages.com/grassfiles#xyz example])&lt;br /&gt;
&lt;br /&gt;
* {{cmd|v.in.ascii}} - Import data from an ASCII file to GRASS vector format.&lt;br /&gt;
: ''Due to memory overhead vector point imports will be limited to a few million data points unless topology and database creation is skipped with the '''-bt''' flags''. It may also be useful to clip the import file to only accept points falling within the current region by using the '''-r''' flag. See {{cmd|g.region}} for details on specifying the region bounds.&lt;br /&gt;
&lt;br /&gt;
=== Analysis ===&lt;br /&gt;
&lt;br /&gt;
* {{cmd|v.outlier}} - Removes outliers from vector point data.&lt;br /&gt;
&lt;br /&gt;
* {{cmd|v.lidar.edgedetection}} - Detect the object's edges from a LIDAR data set.&lt;br /&gt;
&lt;br /&gt;
* {{cmd|v.lidar.growing}} - Building contour determination and Region Growing algorithm for determining the building inside.&lt;br /&gt;
&lt;br /&gt;
* {{cmd|v.lidar.correction}} - Correction of the v.lidar.growing output. It is the last of the three algorithms for LIDAR filtering.&lt;br /&gt;
&lt;br /&gt;
=== Surface generation ===&lt;br /&gt;
&lt;br /&gt;
* {{cmd|v.surf.rst}} - Spatial approximation and topographic analysis using regularized spline with tension.&lt;br /&gt;
&lt;br /&gt;
* {{cmd|v.surf.idw}} - Surface interpolation from vector point data by Inverse Distance Squared Weighting.&lt;br /&gt;
&lt;br /&gt;
* {{cmd|v.surf.bspline}} - Surface interpolation from vector point data by bicubic or bilineal interpolation with Tykhonov regularization.&lt;br /&gt;
&lt;br /&gt;
* {{cmd|r.fillnulls}} - Fills no-data areas in raster maps using v.surf.rst splines interpolation.&lt;br /&gt;
&lt;br /&gt;
== Swath Bathymetry Tools ==&lt;br /&gt;
&lt;br /&gt;
''see also the [[Marine_Science#Multibeam_sonar_processing]] wiki page''&lt;br /&gt;
&lt;br /&gt;
* The [http://david.p.finlayson.googlepages.com/swathwidth v.swathwidith] module by David Finlayson for planning surveys. (development page)&lt;br /&gt;
&lt;br /&gt;
* An example of [http://bambi.otago.ac.nz/hamish/grass/gdal/sidescan_warp.html post-processing scanned paper sidescan swaths] using thin plate spline warping with [http://www.gdal.org/ GDAL's] &amp;quot;&amp;lt;tt&amp;gt;gdalwarp -tps&amp;lt;/tt&amp;gt;&amp;quot; function. (debugging page)&lt;br /&gt;
&lt;br /&gt;
* [[Marine_Science#Import_into_GRASS|GRASS integration]] with [http://www.ldeo.columbia.edu/res/pi/MB-System/ MB-System] (GPL) software for processing Multibeam and Sidescan Sonar data. GRASS + MBsys + [[GMT]] make a nice scriptable trio.&lt;br /&gt;
&lt;br /&gt;
== LIDAR Tools ==&lt;br /&gt;
&lt;br /&gt;
*  {{cmd|r.terraflow}} - computation of flow direction, flow accumulation and other basic topographic terrain indices from massive raster digital elevation models (DEM). From the Duke University [http://terrain.cs.duke.edu/ STREAM] project.&lt;br /&gt;
&lt;br /&gt;
* [http://mpa.itc.it/markus/grass61/demos/rlake/ Flood simulation] using {{cmd|r.lake}}. Includes fancy NVIZ visualization of Trento, Italy, by Markus Neteler.&lt;br /&gt;
&lt;br /&gt;
* [http://www.cs.unc.edu/~isenburg/software/ LAStools] are a set of simple command line tools  (including source code) for converting to/from ASCII, viewing, comparing, and compressing LIDAR data.&lt;br /&gt;
&lt;br /&gt;
* [http://www.liblas.org libLAS] ASPRS LiDAR data translation tools&lt;br /&gt;
&lt;br /&gt;
* See also [[LIDAR#Analysis|LIDAR Analysis]]&lt;br /&gt;
&lt;br /&gt;
== Micro-tutorial for LAS data==&lt;br /&gt;
&lt;br /&gt;
=== Preparation ===&lt;br /&gt;
&lt;br /&gt;
==== Conversion of text files to LAS ====&lt;br /&gt;
&lt;br /&gt;
[http://www.liblas.org/ libLAS] supports the following column types:&lt;br /&gt;
   x - x coordinate&lt;br /&gt;
   y - y coordinate&lt;br /&gt;
   z - z coordinate&lt;br /&gt;
   a - scan angle&lt;br /&gt;
   i - intensity&lt;br /&gt;
   n - number of returns for given pulse (1..n)&lt;br /&gt;
   r - number of this return (1..r)&lt;br /&gt;
   c - classification&lt;br /&gt;
   u - user data (but only 1 byte)&lt;br /&gt;
   p - point source ID&lt;br /&gt;
   e - edge of flight line&lt;br /&gt;
   d - direction of scan flag&lt;br /&gt;
   t - GPS time&lt;br /&gt;
   s - skip column&lt;br /&gt;
&lt;br /&gt;
Sample text data such as:&lt;br /&gt;
   returntime,pulse,east,north,height,intensity,stripe&lt;br /&gt;
   549778.907200,1,673999.940,5099680.080,507.425,20.0,45105&lt;br /&gt;
   ...&lt;br /&gt;
&lt;br /&gt;
can be converted to LAS format like this:&lt;br /&gt;
   returntime - t&lt;br /&gt;
   pulse - r&lt;br /&gt;
   east - x&lt;br /&gt;
   north - y&lt;br /&gt;
   height - z&lt;br /&gt;
   intensity - i&lt;br /&gt;
   stripe - s&lt;br /&gt;
&lt;br /&gt;
First parse (sanity check):&lt;br /&gt;
   txt2las -parse trxyzis data.asc&lt;br /&gt;
&lt;br /&gt;
Then convert:&lt;br /&gt;
   txt2las -parse trxyzis -i data.asc -o data.las &lt;br /&gt;
&lt;br /&gt;
While you may not need to do this conversion for GRASS import, the resulting files are way smaller than the uncompressed text files; additionally, they are in a defined format.&lt;br /&gt;
&lt;br /&gt;
=== LAS Import ===&lt;br /&gt;
&lt;br /&gt;
* Use the [http://www.liblas.org libLAS] utilities to import LAS data into GRASS. &lt;br /&gt;
* Data stored in text files can generally be imported directly into GRASS.&lt;br /&gt;
&lt;br /&gt;
* The data used in the rest of this micro-tutorial can be found at [http://www.appliedimagery.com/Serpent%20Mound%20Model%20LAS%20Data.las appliedimagery.com].&lt;br /&gt;
&lt;br /&gt;
==== Import LAS as raster DEM ====&lt;br /&gt;
&lt;br /&gt;
Check bounds and SRS:&lt;br /&gt;
 $ lasinfo &amp;quot;Serpent_Mound_Model_LAS_Data.las&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
  [...]&lt;br /&gt;
  Min X Y Z                  289020.900000 4320942.610000 166.780000&lt;br /&gt;
  Max X Y Z                  290106.020000 4323641.570000 215.480000&lt;br /&gt;
 Spatial Reference           +proj=utm +zone=17 +ellps=WGS84 +units=m &lt;br /&gt;
&lt;br /&gt;
After creating a suitable UTM zone 17 location (EPSG:32617) &lt;br /&gt;
set the region according to the information from lasinfo at 1m resolution, rounding grid outwards to align to whole meters:&lt;br /&gt;
 GRASS&amp;gt; {{cmd|g.region}} n=4323641.57 s=4320942.61 w=289020.90 e=290106.02 res=1 -ap&lt;br /&gt;
&lt;br /&gt;
Finally, import with {{cmd|r.in.xyz}} with data piped directly from the &amp;lt;tt&amp;gt;las2txt&amp;lt;/tt&amp;gt; program and set a nice equalized color table:&lt;br /&gt;
 BASEMAP=&amp;quot;Serpent_Mound_Model_LAS&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 las2txt --stdout &amp;quot;${BASEMAP}_Data.las&amp;quot; | \&lt;br /&gt;
    r.in.xyz in=- out=${BASEMAP}_Data fs=space method=mean&lt;br /&gt;
 &lt;br /&gt;
 {{cmd|r.colors}} ${BASEMAP}_Data color=bcyr -e&lt;br /&gt;
&lt;br /&gt;
The above example uses the default z-elevation level as the 3rd term, but by using the &amp;lt;tt&amp;gt;las2txt --parse&amp;lt;/tt&amp;gt; command other fields (such as intensity) can be imported instead via &amp;quot;&amp;lt;tt&amp;gt;--parse xyi&amp;lt;/tt&amp;gt;&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
==== Import LAS as vector points ====&lt;br /&gt;
&lt;br /&gt;
Region setting (establishing the grid) is not needed for vector features so we can go directly to the import step. To deal with millions of input points {{cmd|v.in.ascii}} should be run with the options to skip creation of an attribute database and building topology as these can consume large amounts of memory. Note that vector maps without topology built are somewhat limited in their ability to be processed. Most LIDAR specific modules have been adapted to not require &lt;br /&gt;
topology. Even so, after initial cleaning steps it is often more efficient to work with huge datasets in GRASS as raster data.&lt;br /&gt;
&lt;br /&gt;
 las2txt --stdout &amp;quot;${BASEMAP}_Data.las&amp;quot; | \&lt;br /&gt;
   v.in.ascii -tbz z=3 out=&amp;quot;${BASEMAP}_pts&amp;quot; fs=space&lt;br /&gt;
&lt;br /&gt;
If topology was built, you can use {{cmd|d.vect}}'s -z flag to colorize by elevation value. Without topology you can still colorize, but you need to use color rules based on absolute elevations, not percentage of scale.&lt;br /&gt;
&amp;lt;!-- need an absolute color map gradiated across the elev range --&amp;gt;&lt;br /&gt;
 # display colorized points for data with built topology&lt;br /&gt;
 d.vect map=lidar_pts size=1 -z zcolor=elevation&lt;br /&gt;
&lt;br /&gt;
* After import as points you can then use the v.lidar tools to clean the data: {{cmd|v.lidar.correction}}, {{cmd|v.lidar.edgedetection}}, {{cmd|v.lidar.growing}}, and {{cmd|v.outlier}}.&lt;br /&gt;
&lt;br /&gt;
* Vector points can be interpolated into raster DEMs with a number of modules, including {{cmd|v.surf.rst}}, {{cmd|v.surf.bspline}}, and {{cmd|v.surf.idw}}.&lt;br /&gt;
&lt;br /&gt;
=== Clean imported raster DEM ===&lt;br /&gt;
&lt;br /&gt;
(fill holes)&lt;br /&gt;
&lt;br /&gt;
 # convert to vector points&lt;br /&gt;
 r.to.vect -z feature=point in=${BASEMAP}_Data out=${BASEMAP}_pt&lt;br /&gt;
 &lt;br /&gt;
 # interpolate using a regularized spline fit&lt;br /&gt;
 # this is very slow, but produces very high quality output&lt;br /&gt;
 v.surf.rst layer=0 in=${BASEMAP}_pt elev=${BASEMAP}.rst&lt;br /&gt;
 &lt;br /&gt;
 # create 5m buffer area around original data points&lt;br /&gt;
 r.buffer in=${BASEMAP}_Data out=${BASEMAP}.5m_buff dist=5&lt;br /&gt;
 &lt;br /&gt;
 # crop interpolated DEM to only include areas nearby actual data&lt;br /&gt;
 r.mapcalc &amp;quot;${BASEMAP}.filled = \&lt;br /&gt;
    if( isnull(${BASEMAP}.5m_buff), null(), ${BASEMAP}.rst)&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 # set colors to something nice&lt;br /&gt;
 r.colors ${BASEMAP}.filled color=bcyr -e&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Depending on your needs, {{cmd|r.fillnulls}}, {{cmd|v.surf.bspline}}, {{cmd|v.surf.idw}}, {{cmd|r.surf.idw}}, {{cmd|r.surf.idw2}}, or [[GRASS_AddOns#r.surf.nnbathy|r.surf.nnbathy]] may be faster than the {{cmd|v.surf.rst}} method.&lt;br /&gt;
&lt;br /&gt;
=== Visualize raster DEM in 3D ===&lt;br /&gt;
&lt;br /&gt;
 nviz ${BASEMAP}.filled&lt;br /&gt;
&lt;br /&gt;
* Set z-exag to 2.0&lt;br /&gt;
* In Visualize &amp;amp;rarr; Raster Surfaces set the fine (final) resolution to 1, and coarse (preview) resolution to 5.&lt;br /&gt;
* Set the height to 500.0, the perspective to 15.0, and drag the view-puck to the North-West and reasonably zoomed in.&lt;br /&gt;
: You should now be able to see the serpent:&lt;br /&gt;
&lt;br /&gt;
[[Image:LAS_serpent_nviz.jpg|thumb|center|400px|The Great Serpent Mound, Adams County, Ohio, USA]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
It is possible to show vector points in 3D, but millions of them may make the program run slow. Topology is required ({{cmd|v.build}}). Tick the &amp;quot;3D&amp;quot; box in the Visualize &amp;amp;rarr; Vector points dialog.&lt;br /&gt;
&lt;br /&gt;
=== LAS Export ===&lt;br /&gt;
&lt;br /&gt;
==== Export to LAS ====&lt;br /&gt;
&lt;br /&gt;
This is the reverse of the import step, but using {{cmd|v.out.ascii}} or {{cmd|r.out.xyz}} with ''txt2las''.&lt;br /&gt;
Because the v.out.ascii module exports category number which we are not interested in, we cut it away with the UNIX ''cut'' utility.&lt;br /&gt;
&lt;br /&gt;
 v.out.ascii ${BASEMAP}_pts fs=space | cut -f1-3 -d' ' \&lt;br /&gt;
     &amp;gt; ${BASEMAP}_export.txt&lt;br /&gt;
 &lt;br /&gt;
 txt2las --parse xyz -i ${BASEMAP}_export.txt&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Micro-tutorial for LIDAR data analysis ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Simple analysis of single return data ===&lt;br /&gt;
&lt;br /&gt;
Data source: North Carolina sample data set (Lidar data from 2001, near Raleigh, North Carolina). Download from&lt;br /&gt;
   http://www.grassbook.org/ncexternal/&lt;br /&gt;
   -&amp;gt; File: BE3720079200WC20020829m.txt 3.6M (lidar bare earth points [spm])&lt;br /&gt;
&lt;br /&gt;
Scan input file for spatial extent. The -g flag shows the result in a convenient copy-paste format for {{cmd|g.region}}:&lt;br /&gt;
   r.in.xyz BE3720079200WC20020829m.txt out=dummy -s -g&lt;br /&gt;
&lt;br /&gt;
We use this output to set region, predefine 2m raster cells, and polish the odd coordinates with -a:&lt;br /&gt;
   g.region n=222504.439000 s=219456.442000 e=640081.274000 w=637033.274000 res=2 -a -p&lt;br /&gt;
&lt;br /&gt;
==== QUESTION 1: Are these Lidar data sufficiently dense? ====&lt;br /&gt;
&lt;br /&gt;
We compute a raster map representing number of points per cell&lt;br /&gt;
   r.in.xyz BE3720079200WC20020829m.txt out=lid_792_binn2m method=n&lt;br /&gt;
&lt;br /&gt;
Look at the resulting raster map:&lt;br /&gt;
   d.mon x0&lt;br /&gt;
   d.font Vera&lt;br /&gt;
   d.rast.leg lid_792_binn2m&lt;br /&gt;
&lt;br /&gt;
Report point distribution in percent:&lt;br /&gt;
   r.report lid_792_binn2m unit=p&lt;br /&gt;
&lt;br /&gt;
Reduce the resolution to 6m to get at least one point per cell:&lt;br /&gt;
   g.region res=6 -a -p&lt;br /&gt;
   r.in.xyz BE3720079200WC20020829m.txt out=lid_792_binn6m method=n&lt;br /&gt;
   d.rast.leg lid_792_binn6m&lt;br /&gt;
   # ... a few holes remain but that's probably acceptable.&lt;br /&gt;
&lt;br /&gt;
Compute raster maps representing mean elevation for each cell:&lt;br /&gt;
   r.in.xyz BE3720079200WC20020829m.txt out=lid_792_binmean6m  \&lt;br /&gt;
            meth=mean&lt;br /&gt;
   d.rast.leg lid_792_binmean6m&lt;br /&gt;
&lt;br /&gt;
Compute range and variation:&lt;br /&gt;
   r.in.xyz BE3720079200WC20020829m.txt out=lid_792_binrange6m \&lt;br /&gt;
            meth=range&lt;br /&gt;
   d.rast.leg lid_792_binrange6m&lt;br /&gt;
   r.in.xyz BE3720079200WC20020829m.txt out=lid_792_binvar6m   \&lt;br /&gt;
            meth=coeff_var&lt;br /&gt;
   d.rast.leg lid_792_binvar6m&lt;br /&gt;
&lt;br /&gt;
Overlay other GIS maps to map of mean elevation:&lt;br /&gt;
   d.rast.leg lid_792_binmean6m&lt;br /&gt;
   d.vect streets_wake&lt;br /&gt;
   d.vect lakes type=boundary&lt;br /&gt;
   d.vect streams&lt;br /&gt;
&lt;br /&gt;
Now we continue to work in a zoomed spatial subset of the area.&lt;br /&gt;
&lt;br /&gt;
We import only points in the rural area without building topology and using z-coordinate for elevation:&lt;br /&gt;
   g.region rural_1m -p&lt;br /&gt;
   v.in.ascii -ztbr BE3720079200WC20020829m.txt \&lt;br /&gt;
              out=elev_lidrural_bepts z=3&lt;br /&gt;
&lt;br /&gt;
Clear monitor show black-white orthophoto:&lt;br /&gt;
   d.erase -f&lt;br /&gt;
   d.rast ortho_2001_t792_1m&lt;br /&gt;
&lt;br /&gt;
We now use already prepared Lidar vector point maps:&lt;br /&gt;
* elev_lid792_bepts:   Rural area (in tile 792), bare earth lidar point cloud&lt;br /&gt;
* elev_lidrural_mrpts: Rural area multiple return lidar point cloud&lt;br /&gt;
&lt;br /&gt;
Look at ground data:&lt;br /&gt;
d.vect elev_lidrural_bepts siz=2 col=red&lt;br /&gt;
&lt;br /&gt;
Look at &amp;quot;surface&amp;quot; data:&lt;br /&gt;
d.vect elev_lidrural_mrpts siz=1 col=green&lt;br /&gt;
&lt;br /&gt;
Visualize 3D Lidar multi-return points:&lt;br /&gt;
nviz elev_lid792_1m point=elev_lidrural_mrpts&lt;br /&gt;
 # Visualize -&amp;gt; Vector Points -&amp;gt; 3D points&lt;br /&gt;
 #                            -&amp;gt; Icon size 2.25&lt;br /&gt;
 #  --&amp;gt; GRASS book p. 253, fig. 3.15 (see also screenshot [http://www.grassbook.org/about_menu3rd.php here])&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== DEM/DSM separation the simple way by selection of Lidar returns ====&lt;br /&gt;
&lt;br /&gt;
Find out where we have multiple returns:&lt;br /&gt;
   d.rast ortho_2001_t792_1m&lt;br /&gt;
   d.vect elev_lidrural_mrpts where=&amp;quot;return=1&amp;quot; col=red siz=2&lt;br /&gt;
   d.vect elev_lidrural_mrpts where=&amp;quot;return=2&amp;quot; col=green siz=3&lt;br /&gt;
   d.vect elev_lidrural_mrpts where=&amp;quot;return=3&amp;quot; col=blue&lt;br /&gt;
   d.vect elev_lidrural_mrpts where=&amp;quot;return=4&amp;quot; col=yellow&lt;br /&gt;
&lt;br /&gt;
DTM: extract last return(s):&lt;br /&gt;
   v.extract elev_lidrural_mrpts out=elev_lidrural_mrpts_first where=&amp;quot;Return &amp;lt; 2&amp;quot;&lt;br /&gt;
   nviz elev_lid792_1m point=elev_lidrural_mrpts_first&lt;br /&gt;
&lt;br /&gt;
Interpolate to map and look at it:&lt;br /&gt;
   v.surf.rst elev_lidrural_mrpts_first layer=0 elev=elev_lidrural_mrpts_DTM&lt;br /&gt;
   nviz elev_lidrural_mrpts_DTM col=ortho_2001_t792_1m&lt;br /&gt;
&lt;br /&gt;
DSM: extract first return(s):&lt;br /&gt;
   v.extract elev_lidrural_mrpts out=elev_lidrural_mrpts_last where=&amp;quot;Return &amp;gt; 2&amp;quot;&lt;br /&gt;
   nviz elev_lid792_1m point=elev_lidrural_mrpts_last&lt;br /&gt;
&lt;br /&gt;
Interpolate to map and look at it:&lt;br /&gt;
   v.surf.rst elev_lidrural_mrpts_first layer=0 elev=elev_lidrural_mrpts_DSM&lt;br /&gt;
   nviz elev_lidrural_mrpts_DSM col=ortho_2001_t792_1m&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== DEM/DSM separation the more complex way ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;''TODO: verify order of first and last returns in below text''&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
General procedure:&lt;br /&gt;
* Lidar point clouds (first and last return) are imported with {{cmd|v.in.ascii}} (-b flag to not build the topology).&lt;br /&gt;
* Outlier detection is done with {{cmd|v.outlier}} on both first and last return data (NB currently a selection of &amp;lt;/=4 for soe/son in {{cmd|v.outlier}} results in an error message).&lt;br /&gt;
* Then, with {{cmd|v.lidar.edgedetection}}, edges are detected from last return data.&lt;br /&gt;
* The building are generated by {{cmd|v.lidar.growing}} from detected edges.&lt;br /&gt;
* The resulting data are post-processed with {{cmd|v.lidar.correction}}.&lt;br /&gt;
* Finally, the DTM and DSM are generated with {{cmd|v.surf.bspline}} (DTM: uses the 'v.lidar.correction' output; DSM: uses last return output from outlier detection).&lt;br /&gt;
* NB for {{cmd|v.outlier}}, {{cmd|v.lidar.edgedetection}} and {{cmd|v.surf.bspline}}, one spline steps equates to 1m. It is recommended as a starting point that the choice of spline step is roughly 3 or 4 times the planimetric resolution (potential grid resolution) of your data. Experiment from there to obtain better results.&lt;br /&gt;
&lt;br /&gt;
  export GRASS_OVERWRITE=1&lt;br /&gt;
  v.extract elev_lidrural_mrpts out=elev_lidfirst_pts \&lt;br /&gt;
            where=&amp;quot;return = 1&amp;quot;&lt;br /&gt;
  v.extract elev_lidrural_mrpts out=elev_lidlast_pts  \&lt;br /&gt;
            where=&amp;quot;return &amp;gt;= 2&amp;quot;&lt;br /&gt;
  d.vect elev_lidfirst_pts col=red&lt;br /&gt;
  d.vect elev_lidlast_pts col=green&lt;br /&gt;
&lt;br /&gt;
Outlier detection and separation into two maps&lt;br /&gt;
  # 1st return&lt;br /&gt;
  v.outlier elev_lidfirst_pts output=elev_lidfirst_clean \&lt;br /&gt;
            outlier=elev_lidfirst_outl&lt;br /&gt;
  d.erase&lt;br /&gt;
  d.vect elev_lidfirst_clean siz=2&lt;br /&gt;
  d.vect elev_lidfirst_outl col=red&lt;br /&gt;
&lt;br /&gt;
2nd return&lt;br /&gt;
  v.outlier elev_lidlast_pts output=elev_lidlast_clean \&lt;br /&gt;
            outlier=elev_lidlast_outl&lt;br /&gt;
  d.erase&lt;br /&gt;
  d.vect elev_lidlast_clean siz=2&lt;br /&gt;
  d.vect elev_lidlast_outl col=red&lt;br /&gt;
  # -&amp;gt; no outliers visible&lt;br /&gt;
&lt;br /&gt;
Run an edge detection on cleaned last return:&lt;br /&gt;
  v.lidar.edgedetection elev_lidlast_clean \&lt;br /&gt;
                        out=elev_lidlast_edges&lt;br /&gt;
&lt;br /&gt;
Buildings/vegetation are generated from detected edges (bug: you may need to specify the mapset):&lt;br /&gt;
  v.lidar.growing elev_lidlast_edges@lidar out=elev_lidlast_grow \&lt;br /&gt;
                  first=elev_lidfirst_clean&lt;br /&gt;
&lt;br /&gt;
Compare:&lt;br /&gt;
  d.vect elev_lidlast_pts col=blue&lt;br /&gt;
  d.vect elev_lidlast_grow col=green&lt;br /&gt;
&lt;br /&gt;
Correction (this is applied twice):&lt;br /&gt;
  v.lidar.correction elev_lidlast_grow out=elev_lidlast_corr1 \&lt;br /&gt;
                     terrain=elev_lidlast_terr1&lt;br /&gt;
  v.lidar.correction elev_lidlast_corr1 out=elev_lid_dsm \&lt;br /&gt;
                     terrain=elev_lid_dtm&lt;br /&gt;
&lt;br /&gt;
DEM and DSM are generated:&lt;br /&gt;
  # Estimation of lambda_i parameter with cross validation (watch for RMS!)&lt;br /&gt;
  # and note use of bicubic for DSM and bilinear for DTM here and below&lt;br /&gt;
  v.surf.bspline -c elev_lid_dsm sie=100 sin=100 type=bicubic&lt;br /&gt;
  v.surf.bspline -c elev_lid_dtm sie=100 sin=100 type=bilinear&lt;br /&gt;
  &lt;br /&gt;
  # From the cross-validation, we select lambda with minimal RMS error:&lt;br /&gt;
  # generate raster surfaces at 1m resolution &lt;br /&gt;
  v.surf.bspline elev_lid_dsm raster=lidar_dsm lambda=0.1 type=bicubic&lt;br /&gt;
  v.surf.bspline elev_lid_dtm raster=lidar_dtm lambda=0.0001 type=bilinear&lt;br /&gt;
  &lt;br /&gt;
  d.rast lidar_dsm&lt;br /&gt;
  d.rast lidar_dtm&lt;br /&gt;
  &lt;br /&gt;
  nviz lidar_dsm,lidar_dtm \&lt;br /&gt;
       col=ortho_2001_t792_1m,ortho_2001_t792_1m&lt;br /&gt;
&lt;br /&gt;
...with the position slider you can visually separate DSM and DEM, increase z slider (Visualize -&amp;gt; Raster Surface -&amp;gt; Position).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Windows users (6.4.x only?):'''&lt;br /&gt;
* When using the DBF driver (default) it is necessary to manually create the DBF table prior to importing points with {{cmd|v.in.ascii}}:&lt;br /&gt;
  # Manually connect the DBF table&lt;br /&gt;
  db.connect driver=dbf database='$GISDBASE/$LOCATION_NAME/$MAPSET/dbf&lt;br /&gt;
  &lt;br /&gt;
  # Display the connection (bug: has to be a separate command and run or the connection does not work)&lt;br /&gt;
  db.connect -p&lt;br /&gt;
&lt;br /&gt;
* Bug?: {{cmd|v.in.ascii}} is the only module that requires the mapset to be specified with the input file like with {{cmd|v.lidar.growing}} above.&lt;br /&gt;
&lt;br /&gt;
== Sample LIDAR data ==&lt;br /&gt;
&lt;br /&gt;
=== Widely used in GRASS tutorials ===&lt;br /&gt;
&lt;br /&gt;
* [http://www.grassbook.org/data_menu2nd.php Jockey's Ridge, NC, LIDAR dataset]&lt;br /&gt;
* [http://www.grassbook.org/data_menu3rd.php North Carolina OSGeo Edu data set] (includes multi-return LIDAR data)&lt;br /&gt;
&lt;br /&gt;
=== Other ===&lt;br /&gt;
&lt;br /&gt;
* United States Antarctic Resource Center: LIDAR High-resolution DEM Final DATA Downloads&amp;lt;BR&amp;gt;http://usarc.usgs.gov/lidar_dload.shtml&lt;br /&gt;
&lt;br /&gt;
* LIDAR ALSM Research, Arizona State University Ative Tectonics, Research Group&amp;lt;BR&amp;gt;  http://lidar.asu.edu/research.html and http://www.geongrid.org/science/lidar.html&lt;br /&gt;
&lt;br /&gt;
* USGS Center for LIDAR Information Coordination and Knowledge (aka CLICK) - USGS LiDAR point cloud distribution site&amp;lt;BR&amp;gt; http://lidar.cr.usgs.gov&lt;br /&gt;
&lt;br /&gt;
* Washington State Geospatial Data Archive, Mount Saint Helens - Lidar Data &amp;lt;BR&amp;gt;https://wagda.lib.washington.edu/data/type/elevation/lidar/st_helens/&lt;br /&gt;
&lt;br /&gt;
* Puget Sound Lidar Consortium, public-domain high-resolution topography for western Washington&amp;lt;BR&amp;gt;http://pugetsoundlidar.ess.washington.edu/index.htm&lt;br /&gt;
&lt;br /&gt;
* NOAA Topographic Change Mapping LIDAR Data Retrieval Tool (LDART) NOAA Coastal Services Center&amp;lt;BR&amp;gt;http://maps.csc.noaa.gov/TCM/&lt;br /&gt;
&lt;br /&gt;
* Landmap, LIDAR Data from the Environment Agency &amp;lt;BR&amp;gt;http://www.landmap.ac.uk/lidar/lidar.html&lt;br /&gt;
&lt;br /&gt;
* Northern California LIDAR data &amp;lt;BR&amp;gt;http://quake.usgs.gov/research/geology/lidar/  and http://core2.gsfc.nasa.gov/lidar/terrapoint/&lt;br /&gt;
&lt;br /&gt;
* IDAHO GEOSPATIAL , Bare Earth LIDAR DEM Download - UTM &amp;lt;BR&amp;gt;http://inside.uidaho.edu/geodata/LiDAR/LiDARBareEarthDEM_DownloadUTM.htm&lt;br /&gt;
&lt;br /&gt;
* EarthScope Spatial Data Explorer - A java application for querying, browsing, and acquiring data from the EarthScope Spatial Data Repository. Currently includes a number of LiDAR datasets. &amp;lt;BR&amp;gt;http://www.earthscope.org/data/lidar.php&lt;br /&gt;
&lt;br /&gt;
* LIDAR Galley &amp;lt;BR&amp;gt;https://peoiewswebinfo.monmouth.army.mil/JPSD/LIDAR_Gallery.htm&lt;br /&gt;
&lt;br /&gt;
* South Tyrol - Download of DTMs (Homepage in German or Italian) &amp;lt;BR&amp;gt; http://www.provinz.bz.it/raumordnung/grundkarten/utm/default_d.htm&lt;br /&gt;
&lt;br /&gt;
== Links ==&lt;br /&gt;
&lt;br /&gt;
* [http://liblas.org/ libLAS] - LAS 1.0/1.1 ASPRS LiDAR data translation toolset&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>⚠️John Tate</name></author>
	</entry>
	<entry>
		<id>https://grasswiki.osgeo.org/w/index.php?title=LIDAR&amp;diff=9864</id>
		<title>LIDAR</title>
		<link rel="alternate" type="text/html" href="https://grasswiki.osgeo.org/w/index.php?title=LIDAR&amp;diff=9864"/>
		<updated>2009-11-05T16:50:51Z</updated>

		<summary type="html">&lt;p&gt;⚠️John Tate: /* DEM/DSM separation the more complex way */ added to windows users section&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;h1&amp;gt; LIDAR and Multi-beam Swath bathymetry data &amp;lt;/h1&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Modules ==&lt;br /&gt;
&lt;br /&gt;
=== Import ===&lt;br /&gt;
&lt;br /&gt;
* {{cmd|r.in.xyz}} - Create a raster map from an assemblage of many coordinates using univariate statistics. ([http://hamish.bowman.googlepages.com/grassfiles#xyz example])&lt;br /&gt;
&lt;br /&gt;
* {{cmd|v.in.ascii}} - Import data from an ASCII file to GRASS vector format.&lt;br /&gt;
: ''Due to memory overhead vector point imports will be limited to a few million data points unless topology and database creation is skipped with the '''-bt''' flags''. It may also be useful to clip the import file to only accept points falling within the current region by using the '''-r''' flag. See {{cmd|g.region}} for details on specifying the region bounds.&lt;br /&gt;
&lt;br /&gt;
=== Analysis ===&lt;br /&gt;
&lt;br /&gt;
* {{cmd|v.outlier}} - Removes outliers from vector point data.&lt;br /&gt;
&lt;br /&gt;
* {{cmd|v.lidar.edgedetection}} - Detect the object's edges from a LIDAR data set.&lt;br /&gt;
&lt;br /&gt;
* {{cmd|v.lidar.growing}} - Building contour determination and Region Growing algorithm for determining the building inside.&lt;br /&gt;
&lt;br /&gt;
* {{cmd|v.lidar.correction}} - Correction of the v.lidar.growing output. It is the last of the three algorithms for LIDAR filtering.&lt;br /&gt;
&lt;br /&gt;
=== Surface generation ===&lt;br /&gt;
&lt;br /&gt;
* {{cmd|v.surf.rst}} - Spatial approximation and topographic analysis using regularized spline with tension.&lt;br /&gt;
&lt;br /&gt;
* {{cmd|v.surf.idw}} - Surface interpolation from vector point data by Inverse Distance Squared Weighting.&lt;br /&gt;
&lt;br /&gt;
* {{cmd|v.surf.bspline}} - Surface interpolation from vector point data by bicubic or bilineal interpolation with Tykhonov regularization.&lt;br /&gt;
&lt;br /&gt;
* {{cmd|r.fillnulls}} - Fills no-data areas in raster maps using v.surf.rst splines interpolation.&lt;br /&gt;
&lt;br /&gt;
== Swath Bathymetry Tools ==&lt;br /&gt;
&lt;br /&gt;
''see also the [[Marine_Science#Multibeam_sonar_processing]] wiki page''&lt;br /&gt;
&lt;br /&gt;
* The [http://david.p.finlayson.googlepages.com/swathwidth v.swathwidith] module by David Finlayson for planning surveys. (development page)&lt;br /&gt;
&lt;br /&gt;
* An example of [http://bambi.otago.ac.nz/hamish/grass/gdal/sidescan_warp.html post-processing scanned paper sidescan swaths] using thin plate spline warping with [http://www.gdal.org/ GDAL's] &amp;quot;&amp;lt;tt&amp;gt;gdalwarp -tps&amp;lt;/tt&amp;gt;&amp;quot; function. (debugging page)&lt;br /&gt;
&lt;br /&gt;
* [[Marine_Science#Import_into_GRASS|GRASS integration]] with [http://www.ldeo.columbia.edu/res/pi/MB-System/ MB-System] (GPL) software for processing Multibeam and Sidescan Sonar data. GRASS + MBsys + [[GMT]] make a nice scriptable trio.&lt;br /&gt;
&lt;br /&gt;
== LIDAR Tools ==&lt;br /&gt;
&lt;br /&gt;
*  {{cmd|r.terraflow}} - computation of flow direction, flow accumulation and other basic topographic terrain indices from massive raster digital elevation models (DEM). From the Duke University [http://terrain.cs.duke.edu/ STREAM] project.&lt;br /&gt;
&lt;br /&gt;
* [http://mpa.itc.it/markus/grass61/demos/rlake/ Flood simulation] using {{cmd|r.lake}}. Includes fancy NVIZ visualization of Trento, Italy, by Markus Neteler.&lt;br /&gt;
&lt;br /&gt;
* [http://www.cs.unc.edu/~isenburg/software/ LAStools] are a set of simple command line tools  (including source code) for converting to/from ASCII, viewing, comparing, and compressing LIDAR data.&lt;br /&gt;
&lt;br /&gt;
* [http://www.liblas.org libLAS] ASPRS LiDAR data translation tools&lt;br /&gt;
&lt;br /&gt;
* See also [[LIDAR#Analysis|LIDAR Analysis]]&lt;br /&gt;
&lt;br /&gt;
== Micro-tutorial for LAS data==&lt;br /&gt;
&lt;br /&gt;
=== Preparation ===&lt;br /&gt;
&lt;br /&gt;
==== Conversion of text files to LAS ====&lt;br /&gt;
&lt;br /&gt;
[http://www.liblas.org/ libLAS] supports the following column types:&lt;br /&gt;
   x - x coordinate&lt;br /&gt;
   y - y coordinate&lt;br /&gt;
   z - z coordinate&lt;br /&gt;
   a - scan angle&lt;br /&gt;
   i - intensity&lt;br /&gt;
   n - number of returns for given pulse (1..n)&lt;br /&gt;
   r - number of this return (1..r)&lt;br /&gt;
   c - classification&lt;br /&gt;
   u - user data (but only 1 byte)&lt;br /&gt;
   p - point source ID&lt;br /&gt;
   e - edge of flight line&lt;br /&gt;
   d - direction of scan flag&lt;br /&gt;
   t - GPS time&lt;br /&gt;
   s - skip column&lt;br /&gt;
&lt;br /&gt;
Sample text data such as:&lt;br /&gt;
   returntime,pulse,east,north,height,intensity,stripe&lt;br /&gt;
   549778.907200,1,673999.940,5099680.080,507.425,20.0,45105&lt;br /&gt;
   ...&lt;br /&gt;
&lt;br /&gt;
can be converted to LAS format like this:&lt;br /&gt;
   returntime - t&lt;br /&gt;
   pulse - r&lt;br /&gt;
   east - x&lt;br /&gt;
   north - y&lt;br /&gt;
   height - z&lt;br /&gt;
   intensity - i&lt;br /&gt;
   stripe - s&lt;br /&gt;
&lt;br /&gt;
First parse (sanity check):&lt;br /&gt;
   txt2las -parse trxyzis data.asc&lt;br /&gt;
&lt;br /&gt;
Then convert:&lt;br /&gt;
   txt2las -parse trxyzis -i data.asc -o data.las &lt;br /&gt;
&lt;br /&gt;
While you may not need to do this conversion for GRASS import, the resulting files are way smaller than the uncompressed text files; additionally, they are in a defined format.&lt;br /&gt;
&lt;br /&gt;
=== LAS Import ===&lt;br /&gt;
&lt;br /&gt;
* Use the [http://www.liblas.org libLAS] utilities to import LAS data into GRASS. &lt;br /&gt;
* Data stored in text files can generally be imported directly into GRASS.&lt;br /&gt;
&lt;br /&gt;
* The data used in the rest of this micro-tutorial can be found at [http://www.appliedimagery.com/Serpent%20Mound%20Model%20LAS%20Data.las appliedimagery.com].&lt;br /&gt;
&lt;br /&gt;
==== Import LAS as raster DEM ====&lt;br /&gt;
&lt;br /&gt;
Check bounds and SRS:&lt;br /&gt;
 $ lasinfo &amp;quot;Serpent_Mound_Model_LAS_Data.las&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
  [...]&lt;br /&gt;
  Min X Y Z                  289020.900000 4320942.610000 166.780000&lt;br /&gt;
  Max X Y Z                  290106.020000 4323641.570000 215.480000&lt;br /&gt;
 Spatial Reference           +proj=utm +zone=17 +ellps=WGS84 +units=m &lt;br /&gt;
&lt;br /&gt;
After creating a suitable UTM zone 17 location (EPSG:32617) &lt;br /&gt;
set the region according to the information from lasinfo at 1m resolution, rounding grid outwards to align to whole meters:&lt;br /&gt;
 GRASS&amp;gt; {{cmd|g.region}} n=4323641.57 s=4320942.61 w=289020.90 e=290106.02 res=1 -ap&lt;br /&gt;
&lt;br /&gt;
Finally, import with {{cmd|r.in.xyz}} with data piped directly from the &amp;lt;tt&amp;gt;las2txt&amp;lt;/tt&amp;gt; program and set a nice equalized color table:&lt;br /&gt;
 BASEMAP=&amp;quot;Serpent_Mound_Model_LAS&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 las2txt --stdout &amp;quot;${BASEMAP}_Data.las&amp;quot; | \&lt;br /&gt;
    r.in.xyz in=- out=${BASEMAP}_Data fs=space method=mean&lt;br /&gt;
 &lt;br /&gt;
 {{cmd|r.colors}} ${BASEMAP}_Data color=bcyr -e&lt;br /&gt;
&lt;br /&gt;
The above example uses the default z-elevation level as the 3rd term, but by using the &amp;lt;tt&amp;gt;las2txt --parse&amp;lt;/tt&amp;gt; command other fields (such as intensity) can be imported instead via &amp;quot;&amp;lt;tt&amp;gt;--parse xyi&amp;lt;/tt&amp;gt;&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
==== Import LAS as vector points ====&lt;br /&gt;
&lt;br /&gt;
Region setting (establishing the grid) is not needed for vector features so we can go directly to the import step. To deal with millions of input points {{cmd|v.in.ascii}} should be run with the options to skip creation of an attribute database and building topology as these can consume large amounts of memory. Note that vector maps without topology built are somewhat limited in their ability to be processed. Most LIDAR specific modules have been adapted to not require &lt;br /&gt;
topology. Even so, after initial cleaning steps it is often more efficient to work with huge datasets in GRASS as raster data.&lt;br /&gt;
&lt;br /&gt;
 las2txt --stdout &amp;quot;${BASEMAP}_Data.las&amp;quot; | \&lt;br /&gt;
   v.in.ascii -tbz z=3 out=&amp;quot;${BASEMAP}_pts&amp;quot; fs=space&lt;br /&gt;
&lt;br /&gt;
If topology was built, you can use {{cmd|d.vect}}'s -z flag to colorize by elevation value. Without topology you can still colorize, but you need to use color rules based on absolute elevations, not percentage of scale.&lt;br /&gt;
&amp;lt;!-- need an absolute color map gradiated across the elev range --&amp;gt;&lt;br /&gt;
 # display colorized points for data with built topology&lt;br /&gt;
 d.vect map=lidar_pts size=1 -z zcolor=elevation&lt;br /&gt;
&lt;br /&gt;
* After import as points you can then use the v.lidar tools to clean the data: {{cmd|v.lidar.correction}}, {{cmd|v.lidar.edgedetection}}, {{cmd|v.lidar.growing}}, and {{cmd|v.outlier}}.&lt;br /&gt;
&lt;br /&gt;
* Vector points can be interpolated into raster DEMs with a number of modules, including {{cmd|v.surf.rst}}, {{cmd|v.surf.bspline}}, and {{cmd|v.surf.idw}}.&lt;br /&gt;
&lt;br /&gt;
=== Clean imported raster DEM ===&lt;br /&gt;
&lt;br /&gt;
(fill holes)&lt;br /&gt;
&lt;br /&gt;
 # convert to vector points&lt;br /&gt;
 r.to.vect -z feature=point in=${BASEMAP}_Data out=${BASEMAP}_pt&lt;br /&gt;
 &lt;br /&gt;
 # interpolate using a regularized spline fit&lt;br /&gt;
 # this is very slow, but produces very high quality output&lt;br /&gt;
 v.surf.rst layer=0 in=${BASEMAP}_pt elev=${BASEMAP}.rst&lt;br /&gt;
 &lt;br /&gt;
 # create 5m buffer area around original data points&lt;br /&gt;
 r.buffer in=${BASEMAP}_Data out=${BASEMAP}.5m_buff dist=5&lt;br /&gt;
 &lt;br /&gt;
 # crop interpolated DEM to only include areas nearby actual data&lt;br /&gt;
 r.mapcalc &amp;quot;${BASEMAP}.filled = \&lt;br /&gt;
    if( isnull(${BASEMAP}.5m_buff), null(), ${BASEMAP}.rst)&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 # set colors to something nice&lt;br /&gt;
 r.colors ${BASEMAP}.filled color=bcyr -e&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Depending on your needs, {{cmd|r.fillnulls}}, {{cmd|v.surf.bspline}}, {{cmd|v.surf.idw}}, {{cmd|r.surf.idw}}, {{cmd|r.surf.idw2}}, or [[GRASS_AddOns#r.surf.nnbathy|r.surf.nnbathy]] may be faster than the {{cmd|v.surf.rst}} method.&lt;br /&gt;
&lt;br /&gt;
=== Visualize raster DEM in 3D ===&lt;br /&gt;
&lt;br /&gt;
 nviz ${BASEMAP}.filled&lt;br /&gt;
&lt;br /&gt;
* Set z-exag to 2.0&lt;br /&gt;
* In Visualize &amp;amp;rarr; Raster Surfaces set the fine (final) resolution to 1, and coarse (preview) resolution to 5.&lt;br /&gt;
* Set the height to 500.0, the perspective to 15.0, and drag the view-puck to the North-West and reasonably zoomed in.&lt;br /&gt;
: You should now be able to see the serpent:&lt;br /&gt;
&lt;br /&gt;
[[Image:LAS_serpent_nviz.jpg|thumb|center|400px|The Great Serpent Mound, Adams County, Ohio, USA]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
It is possible to show vector points in 3D, but millions of them may make the program run slow. Topology is required ({{cmd|v.build}}). Tick the &amp;quot;3D&amp;quot; box in the Visualize &amp;amp;rarr; Vector points dialog.&lt;br /&gt;
&lt;br /&gt;
=== LAS Export ===&lt;br /&gt;
&lt;br /&gt;
==== Export to LAS ====&lt;br /&gt;
&lt;br /&gt;
This is the reverse of the import step, but using {{cmd|v.out.ascii}} or {{cmd|r.out.xyz}} with ''txt2las''.&lt;br /&gt;
Because the v.out.ascii module exports category number which we are not interested in, we cut it away with the UNIX ''cut'' utility.&lt;br /&gt;
&lt;br /&gt;
 v.out.ascii ${BASEMAP}_pts fs=space | cut -f1-3 -d' ' \&lt;br /&gt;
     &amp;gt; ${BASEMAP}_export.txt&lt;br /&gt;
 &lt;br /&gt;
 txt2las --parse xyz -i ${BASEMAP}_export.txt&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Micro-tutorial for LIDAR data analysis ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Simple analysis of single return data ===&lt;br /&gt;
&lt;br /&gt;
Data source: North Carolina sample data set (Lidar data from 2001, near Raleigh, North Carolina). Download from&lt;br /&gt;
   http://www.grassbook.org/ncexternal/&lt;br /&gt;
   -&amp;gt; File: BE3720079200WC20020829m.txt 3.6M (lidar bare earth points [spm])&lt;br /&gt;
&lt;br /&gt;
Scan input file for spatial extent. The -g flag shows the result in a convenient copy-paste format for {{cmd|g.region}}:&lt;br /&gt;
   r.in.xyz BE3720079200WC20020829m.txt out=dummy -s -g&lt;br /&gt;
&lt;br /&gt;
We use this output to set region, predefine 2m raster cells, and polish the odd coordinates with -a:&lt;br /&gt;
   g.region n=222504.439000 s=219456.442000 e=640081.274000 w=637033.274000 res=2 -a -p&lt;br /&gt;
&lt;br /&gt;
==== QUESTION 1: Are these Lidar data sufficiently dense? ====&lt;br /&gt;
&lt;br /&gt;
We compute a raster map representing number of points per cell&lt;br /&gt;
   r.in.xyz BE3720079200WC20020829m.txt out=lid_792_binn2m method=n&lt;br /&gt;
&lt;br /&gt;
Look at the resulting raster map:&lt;br /&gt;
   d.mon x0&lt;br /&gt;
   d.font Vera&lt;br /&gt;
   d.rast.leg lid_792_binn2m&lt;br /&gt;
&lt;br /&gt;
Report point distribution in percent:&lt;br /&gt;
   r.report lid_792_binn2m unit=p&lt;br /&gt;
&lt;br /&gt;
Reduce the resolution to 6m to get at least one point per cell:&lt;br /&gt;
   g.region res=6 -a -p&lt;br /&gt;
   r.in.xyz BE3720079200WC20020829m.txt out=lid_792_binn6m method=n&lt;br /&gt;
   d.rast.leg lid_792_binn6m&lt;br /&gt;
   # ... a few holes remain but that's probably acceptable.&lt;br /&gt;
&lt;br /&gt;
Compute raster maps representing mean elevation for each cell:&lt;br /&gt;
   r.in.xyz BE3720079200WC20020829m.txt out=lid_792_binmean6m  \&lt;br /&gt;
            meth=mean&lt;br /&gt;
   d.rast.leg lid_792_binmean6m&lt;br /&gt;
&lt;br /&gt;
Compute range and variation:&lt;br /&gt;
   r.in.xyz BE3720079200WC20020829m.txt out=lid_792_binrange6m \&lt;br /&gt;
            meth=range&lt;br /&gt;
   d.rast.leg lid_792_binrange6m&lt;br /&gt;
   r.in.xyz BE3720079200WC20020829m.txt out=lid_792_binvar6m   \&lt;br /&gt;
            meth=coeff_var&lt;br /&gt;
   d.rast.leg lid_792_binvar6m&lt;br /&gt;
&lt;br /&gt;
Overlay other GIS maps to map of mean elevation:&lt;br /&gt;
   d.rast.leg lid_792_binmean6m&lt;br /&gt;
   d.vect streets_wake&lt;br /&gt;
   d.vect lakes type=boundary&lt;br /&gt;
   d.vect streams&lt;br /&gt;
&lt;br /&gt;
Now we continue to work in a zoomed spatial subset of the area.&lt;br /&gt;
&lt;br /&gt;
We import only points in the rural area without building topology and using z-coordinate for elevation:&lt;br /&gt;
   g.region rural_1m -p&lt;br /&gt;
   v.in.ascii -ztbr BE3720079200WC20020829m.txt \&lt;br /&gt;
              out=elev_lidrural_bepts z=3&lt;br /&gt;
&lt;br /&gt;
Clear monitor show black-white orthophoto:&lt;br /&gt;
   d.erase -f&lt;br /&gt;
   d.rast ortho_2001_t792_1m&lt;br /&gt;
&lt;br /&gt;
We now use already prepared Lidar vector point maps:&lt;br /&gt;
* elev_lid792_bepts:   Rural area (in tile 792), bare earth lidar point cloud&lt;br /&gt;
* elev_lidrural_mrpts: Rural area multiple return lidar point cloud&lt;br /&gt;
&lt;br /&gt;
Look at ground data:&lt;br /&gt;
d.vect elev_lidrural_bepts siz=2 col=red&lt;br /&gt;
&lt;br /&gt;
Look at &amp;quot;surface&amp;quot; data:&lt;br /&gt;
d.vect elev_lidrural_mrpts siz=1 col=green&lt;br /&gt;
&lt;br /&gt;
Visualize 3D Lidar multi-return points:&lt;br /&gt;
nviz elev_lid792_1m point=elev_lidrural_mrpts&lt;br /&gt;
 # Visualize -&amp;gt; Vector Points -&amp;gt; 3D points&lt;br /&gt;
 #                            -&amp;gt; Icon size 2.25&lt;br /&gt;
 #  --&amp;gt; GRASS book p. 253, fig. 3.15 (see also screenshot [http://www.grassbook.org/about_menu3rd.php here])&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== DEM/DSM separation the simple way by selection of Lidar returns ====&lt;br /&gt;
&lt;br /&gt;
Find out where we have multiple returns:&lt;br /&gt;
   d.rast ortho_2001_t792_1m&lt;br /&gt;
   d.vect elev_lidrural_mrpts where=&amp;quot;return=1&amp;quot; col=red siz=2&lt;br /&gt;
   d.vect elev_lidrural_mrpts where=&amp;quot;return=2&amp;quot; col=green siz=3&lt;br /&gt;
   d.vect elev_lidrural_mrpts where=&amp;quot;return=3&amp;quot; col=blue&lt;br /&gt;
   d.vect elev_lidrural_mrpts where=&amp;quot;return=4&amp;quot; col=yellow&lt;br /&gt;
&lt;br /&gt;
DTM: extract last return(s):&lt;br /&gt;
   v.extract elev_lidrural_mrpts out=elev_lidrural_mrpts_first where=&amp;quot;Return &amp;lt; 2&amp;quot;&lt;br /&gt;
   nviz elev_lid792_1m point=elev_lidrural_mrpts_first&lt;br /&gt;
&lt;br /&gt;
Interpolate to map and look at it:&lt;br /&gt;
   v.surf.rst elev_lidrural_mrpts_first layer=0 elev=elev_lidrural_mrpts_DTM&lt;br /&gt;
   nviz elev_lidrural_mrpts_DTM col=ortho_2001_t792_1m&lt;br /&gt;
&lt;br /&gt;
DSM: extract first return(s):&lt;br /&gt;
   v.extract elev_lidrural_mrpts out=elev_lidrural_mrpts_last where=&amp;quot;Return &amp;gt; 2&amp;quot;&lt;br /&gt;
   nviz elev_lid792_1m point=elev_lidrural_mrpts_last&lt;br /&gt;
&lt;br /&gt;
Interpolate to map and look at it:&lt;br /&gt;
   v.surf.rst elev_lidrural_mrpts_first layer=0 elev=elev_lidrural_mrpts_DSM&lt;br /&gt;
   nviz elev_lidrural_mrpts_DSM col=ortho_2001_t792_1m&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== DEM/DSM separation the more complex way ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;''TODO: verify order of first and last returns in below text''&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
General procedure:&lt;br /&gt;
* Lidar point clouds (first and last return) are imported with {{cmd|v.in.ascii}} (-b flag to not build the topology).&lt;br /&gt;
* Outlier detection is done with {{cmd|v.outlier}} on both first and last return data (NB currently a selection of &amp;lt;/=4 for soe/son in {{cmd|v.outlier}} results in an error message).&lt;br /&gt;
* Then, with {{cmd|v.lidar.edgedetection}}, edges are detected from last return data.&lt;br /&gt;
* The building are generated by {{cmd|v.lidar.growing}} from detected edges.&lt;br /&gt;
* The resulting data are post-processed with {{cmd|v.lidar.correction}}.&lt;br /&gt;
* Finally, the DTM and DSM are generated with {{cmd|v.surf.bspline}} (DTM: uses the 'v.lidar.correction' output; DSM: uses last return output from outlier detection).&lt;br /&gt;
* NB for {{cmd|v.outlier}}, {{cmd|v.lidar.edgedetection}} and {{cmd|v.surf.bspline}}, one spline steps equates to 1m. It is recommended as a starting point that the choice of spline step is roughly 3 or 4 times the planimetric resolution (potential grid resolution) of your data. Experiment from there to obtain better results.&lt;br /&gt;
&lt;br /&gt;
  export GRASS_OVERWRITE=1&lt;br /&gt;
  v.extract elev_lidrural_mrpts out=elev_lidfirst_pts \&lt;br /&gt;
            where=&amp;quot;return = 1&amp;quot;&lt;br /&gt;
  v.extract elev_lidrural_mrpts out=elev_lidlast_pts  \&lt;br /&gt;
            where=&amp;quot;return &amp;gt;= 2&amp;quot;&lt;br /&gt;
  d.vect elev_lidfirst_pts col=red&lt;br /&gt;
  d.vect elev_lidlast_pts col=green&lt;br /&gt;
&lt;br /&gt;
Outlier detection and separation into two maps&lt;br /&gt;
  # 1st return&lt;br /&gt;
  v.outlier elev_lidfirst_pts output=elev_lidfirst_clean \&lt;br /&gt;
            outlier=elev_lidfirst_outl&lt;br /&gt;
  d.erase&lt;br /&gt;
  d.vect elev_lidfirst_clean siz=2&lt;br /&gt;
  d.vect elev_lidfirst_outl col=red&lt;br /&gt;
&lt;br /&gt;
2nd return&lt;br /&gt;
  v.outlier elev_lidlast_pts output=elev_lidlast_clean \&lt;br /&gt;
            outlier=elev_lidlast_outl&lt;br /&gt;
  d.erase&lt;br /&gt;
  d.vect elev_lidlast_clean siz=2&lt;br /&gt;
  d.vect elev_lidlast_outl col=red&lt;br /&gt;
  # -&amp;gt; no outliers visible&lt;br /&gt;
&lt;br /&gt;
Run an edge detection on cleaned last return:&lt;br /&gt;
  v.lidar.edgedetection elev_lidlast_clean \&lt;br /&gt;
                        out=elev_lidlast_edges&lt;br /&gt;
&lt;br /&gt;
Buildings/vegetation are generated from detected edges (bug: you may need to specify the mapset):&lt;br /&gt;
  v.lidar.growing elev_lidlast_edges@lidar out=elev_lidlast_grow \&lt;br /&gt;
                  first=elev_lidfirst_clean&lt;br /&gt;
&lt;br /&gt;
Compare:&lt;br /&gt;
  d.vect elev_lidlast_pts col=blue&lt;br /&gt;
  d.vect elev_lidlast_grow col=green&lt;br /&gt;
&lt;br /&gt;
Correction (this is applied twice):&lt;br /&gt;
  v.lidar.correction elev_lidlast_grow out=elev_lidlast_corr1 \&lt;br /&gt;
                     terrain=elev_lidlast_terr1&lt;br /&gt;
  v.lidar.correction elev_lidlast_corr1 out=elev_lid_dsm \&lt;br /&gt;
                     terrain=elev_lid_dtm&lt;br /&gt;
&lt;br /&gt;
DEM and DSM are generated:&lt;br /&gt;
  # Estimation of lambda_i parameter with cross validation (watch for RMS!)&lt;br /&gt;
  # and note use of bicubic for DSM and bilinear for DTM here and below&lt;br /&gt;
  v.surf.bspline -c elev_lid_dsm sie=100 sin=100 type=bicubic&lt;br /&gt;
  v.surf.bspline -c elev_lid_dtm sie=100 sin=100 type=bilinear&lt;br /&gt;
  &lt;br /&gt;
  # From the cross-validation, we select lambda with minimal RMS error:&lt;br /&gt;
  # generate raster surfaces at 1m resolution &lt;br /&gt;
  v.surf.bspline elev_lid_dsm raster=lidar_dsm lambda=0.1 type=bicubic&lt;br /&gt;
  v.surf.bspline elev_lid_dtm raster=lidar_dtm lambda=0.0001 type=bilinear&lt;br /&gt;
  &lt;br /&gt;
  d.rast lidar_dsm&lt;br /&gt;
  d.rast lidar_dtm&lt;br /&gt;
  &lt;br /&gt;
  nviz lidar_dsm,lidar_dtm \&lt;br /&gt;
       col=ortho_2001_t792_1m,ortho_2001_t792_1m&lt;br /&gt;
&lt;br /&gt;
...with the position slider you can visually separate DSM and DEM, increase z slider (Visualize -&amp;gt; Raster Surface -&amp;gt; Position).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Windows users (6.4.x only?):'''&lt;br /&gt;
* When using the DBF driver (default) it is necessary to manually create the DBF table prior to importing points with {{cmd|v.in.ascii}}:&lt;br /&gt;
  # Manually connect the DBF table&lt;br /&gt;
  db.connect driver=dbf database='$GISDBASE/$LOCATION_NAME/$MAPSET/dbf&lt;br /&gt;
  &lt;br /&gt;
  # Display the connection (has to be a separate command and run or the connection does not work)&lt;br /&gt;
  db.connect -p&lt;br /&gt;
&lt;br /&gt;
* Bug?: {{cmd|v.in.ascii}} is the only module that requires the mapset to be specified with the input file like with {{cmd|v.lidar.growing}} above.&lt;br /&gt;
&lt;br /&gt;
== Sample LIDAR data ==&lt;br /&gt;
&lt;br /&gt;
=== Widely used in GRASS tutorials ===&lt;br /&gt;
&lt;br /&gt;
* [http://www.grassbook.org/data_menu2nd.php Jockey's Ridge, NC, LIDAR dataset]&lt;br /&gt;
* [http://www.grassbook.org/data_menu3rd.php North Carolina OSGeo Edu data set] (includes multi-return LIDAR data)&lt;br /&gt;
&lt;br /&gt;
=== Other ===&lt;br /&gt;
&lt;br /&gt;
* United States Antarctic Resource Center: LIDAR High-resolution DEM Final DATA Downloads&amp;lt;BR&amp;gt;http://usarc.usgs.gov/lidar_dload.shtml&lt;br /&gt;
&lt;br /&gt;
* LIDAR ALSM Research, Arizona State University Ative Tectonics, Research Group&amp;lt;BR&amp;gt;  http://lidar.asu.edu/research.html and http://www.geongrid.org/science/lidar.html&lt;br /&gt;
&lt;br /&gt;
* USGS Center for LIDAR Information Coordination and Knowledge (aka CLICK) - USGS LiDAR point cloud distribution site&amp;lt;BR&amp;gt; http://lidar.cr.usgs.gov&lt;br /&gt;
&lt;br /&gt;
* Washington State Geospatial Data Archive, Mount Saint Helens - Lidar Data &amp;lt;BR&amp;gt;https://wagda.lib.washington.edu/data/type/elevation/lidar/st_helens/&lt;br /&gt;
&lt;br /&gt;
* Puget Sound Lidar Consortium, public-domain high-resolution topography for western Washington&amp;lt;BR&amp;gt;http://pugetsoundlidar.ess.washington.edu/index.htm&lt;br /&gt;
&lt;br /&gt;
* NOAA Topographic Change Mapping LIDAR Data Retrieval Tool (LDART) NOAA Coastal Services Center&amp;lt;BR&amp;gt;http://maps.csc.noaa.gov/TCM/&lt;br /&gt;
&lt;br /&gt;
* Landmap, LIDAR Data from the Environment Agency &amp;lt;BR&amp;gt;http://www.landmap.ac.uk/lidar/lidar.html&lt;br /&gt;
&lt;br /&gt;
* Northern California LIDAR data &amp;lt;BR&amp;gt;http://quake.usgs.gov/research/geology/lidar/  and http://core2.gsfc.nasa.gov/lidar/terrapoint/&lt;br /&gt;
&lt;br /&gt;
* IDAHO GEOSPATIAL , Bare Earth LIDAR DEM Download - UTM &amp;lt;BR&amp;gt;http://inside.uidaho.edu/geodata/LiDAR/LiDARBareEarthDEM_DownloadUTM.htm&lt;br /&gt;
&lt;br /&gt;
* EarthScope Spatial Data Explorer - A java application for querying, browsing, and acquiring data from the EarthScope Spatial Data Repository. Currently includes a number of LiDAR datasets. &amp;lt;BR&amp;gt;http://www.earthscope.org/data/lidar.php&lt;br /&gt;
&lt;br /&gt;
* LIDAR Galley &amp;lt;BR&amp;gt;https://peoiewswebinfo.monmouth.army.mil/JPSD/LIDAR_Gallery.htm&lt;br /&gt;
&lt;br /&gt;
* South Tyrol - Download of DTMs (Homepage in German or Italian) &amp;lt;BR&amp;gt; http://www.provinz.bz.it/raumordnung/grundkarten/utm/default_d.htm&lt;br /&gt;
&lt;br /&gt;
== Links ==&lt;br /&gt;
&lt;br /&gt;
* [http://liblas.org/ libLAS] - LAS 1.0/1.1 ASPRS LiDAR data translation toolset&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>⚠️John Tate</name></author>
	</entry>
	<entry>
		<id>https://grasswiki.osgeo.org/w/index.php?title=LIDAR&amp;diff=9863</id>
		<title>LIDAR</title>
		<link rel="alternate" type="text/html" href="https://grasswiki.osgeo.org/w/index.php?title=LIDAR&amp;diff=9863"/>
		<updated>2009-11-05T15:56:31Z</updated>

		<summary type="html">&lt;p&gt;⚠️John Tate: /* DEM/DSM separation the more complex way */ spelling error of mine :)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;h1&amp;gt; LIDAR and Multi-beam Swath bathymetry data &amp;lt;/h1&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Modules ==&lt;br /&gt;
&lt;br /&gt;
=== Import ===&lt;br /&gt;
&lt;br /&gt;
* {{cmd|r.in.xyz}} - Create a raster map from an assemblage of many coordinates using univariate statistics. ([http://hamish.bowman.googlepages.com/grassfiles#xyz example])&lt;br /&gt;
&lt;br /&gt;
* {{cmd|v.in.ascii}} - Import data from an ASCII file to GRASS vector format.&lt;br /&gt;
: ''Due to memory overhead vector point imports will be limited to a few million data points unless topology and database creation is skipped with the '''-bt''' flags''. It may also be useful to clip the import file to only accept points falling within the current region by using the '''-r''' flag. See {{cmd|g.region}} for details on specifying the region bounds.&lt;br /&gt;
&lt;br /&gt;
=== Analysis ===&lt;br /&gt;
&lt;br /&gt;
* {{cmd|v.outlier}} - Removes outliers from vector point data.&lt;br /&gt;
&lt;br /&gt;
* {{cmd|v.lidar.edgedetection}} - Detect the object's edges from a LIDAR data set.&lt;br /&gt;
&lt;br /&gt;
* {{cmd|v.lidar.growing}} - Building contour determination and Region Growing algorithm for determining the building inside.&lt;br /&gt;
&lt;br /&gt;
* {{cmd|v.lidar.correction}} - Correction of the v.lidar.growing output. It is the last of the three algorithms for LIDAR filtering.&lt;br /&gt;
&lt;br /&gt;
=== Surface generation ===&lt;br /&gt;
&lt;br /&gt;
* {{cmd|v.surf.rst}} - Spatial approximation and topographic analysis using regularized spline with tension.&lt;br /&gt;
&lt;br /&gt;
* {{cmd|v.surf.idw}} - Surface interpolation from vector point data by Inverse Distance Squared Weighting.&lt;br /&gt;
&lt;br /&gt;
* {{cmd|v.surf.bspline}} - Surface interpolation from vector point data by bicubic or bilineal interpolation with Tykhonov regularization.&lt;br /&gt;
&lt;br /&gt;
* {{cmd|r.fillnulls}} - Fills no-data areas in raster maps using v.surf.rst splines interpolation.&lt;br /&gt;
&lt;br /&gt;
== Swath Bathymetry Tools ==&lt;br /&gt;
&lt;br /&gt;
''see also the [[Marine_Science#Multibeam_sonar_processing]] wiki page''&lt;br /&gt;
&lt;br /&gt;
* The [http://david.p.finlayson.googlepages.com/swathwidth v.swathwidith] module by David Finlayson for planning surveys. (development page)&lt;br /&gt;
&lt;br /&gt;
* An example of [http://bambi.otago.ac.nz/hamish/grass/gdal/sidescan_warp.html post-processing scanned paper sidescan swaths] using thin plate spline warping with [http://www.gdal.org/ GDAL's] &amp;quot;&amp;lt;tt&amp;gt;gdalwarp -tps&amp;lt;/tt&amp;gt;&amp;quot; function. (debugging page)&lt;br /&gt;
&lt;br /&gt;
* [[Marine_Science#Import_into_GRASS|GRASS integration]] with [http://www.ldeo.columbia.edu/res/pi/MB-System/ MB-System] (GPL) software for processing Multibeam and Sidescan Sonar data. GRASS + MBsys + [[GMT]] make a nice scriptable trio.&lt;br /&gt;
&lt;br /&gt;
== LIDAR Tools ==&lt;br /&gt;
&lt;br /&gt;
*  {{cmd|r.terraflow}} - computation of flow direction, flow accumulation and other basic topographic terrain indices from massive raster digital elevation models (DEM). From the Duke University [http://terrain.cs.duke.edu/ STREAM] project.&lt;br /&gt;
&lt;br /&gt;
* [http://mpa.itc.it/markus/grass61/demos/rlake/ Flood simulation] using {{cmd|r.lake}}. Includes fancy NVIZ visualization of Trento, Italy, by Markus Neteler.&lt;br /&gt;
&lt;br /&gt;
* [http://www.cs.unc.edu/~isenburg/software/ LAStools] are a set of simple command line tools  (including source code) for converting to/from ASCII, viewing, comparing, and compressing LIDAR data.&lt;br /&gt;
&lt;br /&gt;
* [http://www.liblas.org libLAS] ASPRS LiDAR data translation tools&lt;br /&gt;
&lt;br /&gt;
* See also [[LIDAR#Analysis|LIDAR Analysis]]&lt;br /&gt;
&lt;br /&gt;
== Micro-tutorial for LAS data==&lt;br /&gt;
&lt;br /&gt;
=== Preparation ===&lt;br /&gt;
&lt;br /&gt;
==== Conversion of text files to LAS ====&lt;br /&gt;
&lt;br /&gt;
[http://www.liblas.org/ libLAS] supports the following column types:&lt;br /&gt;
   x - x coordinate&lt;br /&gt;
   y - y coordinate&lt;br /&gt;
   z - z coordinate&lt;br /&gt;
   a - scan angle&lt;br /&gt;
   i - intensity&lt;br /&gt;
   n - number of returns for given pulse (1..n)&lt;br /&gt;
   r - number of this return (1..r)&lt;br /&gt;
   c - classification&lt;br /&gt;
   u - user data (but only 1 byte)&lt;br /&gt;
   p - point source ID&lt;br /&gt;
   e - edge of flight line&lt;br /&gt;
   d - direction of scan flag&lt;br /&gt;
   t - GPS time&lt;br /&gt;
   s - skip column&lt;br /&gt;
&lt;br /&gt;
Sample text data such as:&lt;br /&gt;
   returntime,pulse,east,north,height,intensity,stripe&lt;br /&gt;
   549778.907200,1,673999.940,5099680.080,507.425,20.0,45105&lt;br /&gt;
   ...&lt;br /&gt;
&lt;br /&gt;
can be converted to LAS format like this:&lt;br /&gt;
   returntime - t&lt;br /&gt;
   pulse - r&lt;br /&gt;
   east - x&lt;br /&gt;
   north - y&lt;br /&gt;
   height - z&lt;br /&gt;
   intensity - i&lt;br /&gt;
   stripe - s&lt;br /&gt;
&lt;br /&gt;
First parse (sanity check):&lt;br /&gt;
   txt2las -parse trxyzis data.asc&lt;br /&gt;
&lt;br /&gt;
Then convert:&lt;br /&gt;
   txt2las -parse trxyzis -i data.asc -o data.las &lt;br /&gt;
&lt;br /&gt;
While you may not need to do this conversion for GRASS import, the resulting files are way smaller than the uncompressed text files; additionally, they are in a defined format.&lt;br /&gt;
&lt;br /&gt;
=== LAS Import ===&lt;br /&gt;
&lt;br /&gt;
* Use the [http://www.liblas.org libLAS] utilities to import LAS data into GRASS. &lt;br /&gt;
* Data stored in text files can generally be imported directly into GRASS.&lt;br /&gt;
&lt;br /&gt;
* The data used in the rest of this micro-tutorial can be found at [http://www.appliedimagery.com/Serpent%20Mound%20Model%20LAS%20Data.las appliedimagery.com].&lt;br /&gt;
&lt;br /&gt;
==== Import LAS as raster DEM ====&lt;br /&gt;
&lt;br /&gt;
Check bounds and SRS:&lt;br /&gt;
 $ lasinfo &amp;quot;Serpent_Mound_Model_LAS_Data.las&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
  [...]&lt;br /&gt;
  Min X Y Z                  289020.900000 4320942.610000 166.780000&lt;br /&gt;
  Max X Y Z                  290106.020000 4323641.570000 215.480000&lt;br /&gt;
 Spatial Reference           +proj=utm +zone=17 +ellps=WGS84 +units=m &lt;br /&gt;
&lt;br /&gt;
After creating a suitable UTM zone 17 location (EPSG:32617) &lt;br /&gt;
set the region according to the information from lasinfo at 1m resolution, rounding grid outwards to align to whole meters:&lt;br /&gt;
 GRASS&amp;gt; {{cmd|g.region}} n=4323641.57 s=4320942.61 w=289020.90 e=290106.02 res=1 -ap&lt;br /&gt;
&lt;br /&gt;
Finally, import with {{cmd|r.in.xyz}} with data piped directly from the &amp;lt;tt&amp;gt;las2txt&amp;lt;/tt&amp;gt; program and set a nice equalized color table:&lt;br /&gt;
 BASEMAP=&amp;quot;Serpent_Mound_Model_LAS&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 las2txt --stdout &amp;quot;${BASEMAP}_Data.las&amp;quot; | \&lt;br /&gt;
    r.in.xyz in=- out=${BASEMAP}_Data fs=space method=mean&lt;br /&gt;
 &lt;br /&gt;
 {{cmd|r.colors}} ${BASEMAP}_Data color=bcyr -e&lt;br /&gt;
&lt;br /&gt;
The above example uses the default z-elevation level as the 3rd term, but by using the &amp;lt;tt&amp;gt;las2txt --parse&amp;lt;/tt&amp;gt; command other fields (such as intensity) can be imported instead via &amp;quot;&amp;lt;tt&amp;gt;--parse xyi&amp;lt;/tt&amp;gt;&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
==== Import LAS as vector points ====&lt;br /&gt;
&lt;br /&gt;
Region setting (establishing the grid) is not needed for vector features so we can go directly to the import step. To deal with millions of input points {{cmd|v.in.ascii}} should be run with the options to skip creation of an attribute database and building topology as these can consume large amounts of memory. Note that vector maps without topology built are somewhat limited in their ability to be processed. Most LIDAR specific modules have been adapted to not require &lt;br /&gt;
topology. Even so, after initial cleaning steps it is often more efficient to work with huge datasets in GRASS as raster data.&lt;br /&gt;
&lt;br /&gt;
 las2txt --stdout &amp;quot;${BASEMAP}_Data.las&amp;quot; | \&lt;br /&gt;
   v.in.ascii -tbz z=3 out=&amp;quot;${BASEMAP}_pts&amp;quot; fs=space&lt;br /&gt;
&lt;br /&gt;
If topology was built, you can use {{cmd|d.vect}}'s -z flag to colorize by elevation value. Without topology you can still colorize, but you need to use color rules based on absolute elevations, not percentage of scale.&lt;br /&gt;
&amp;lt;!-- need an absolute color map gradiated across the elev range --&amp;gt;&lt;br /&gt;
 # display colorized points for data with built topology&lt;br /&gt;
 d.vect map=lidar_pts size=1 -z zcolor=elevation&lt;br /&gt;
&lt;br /&gt;
* After import as points you can then use the v.lidar tools to clean the data: {{cmd|v.lidar.correction}}, {{cmd|v.lidar.edgedetection}}, {{cmd|v.lidar.growing}}, and {{cmd|v.outlier}}.&lt;br /&gt;
&lt;br /&gt;
* Vector points can be interpolated into raster DEMs with a number of modules, including {{cmd|v.surf.rst}}, {{cmd|v.surf.bspline}}, and {{cmd|v.surf.idw}}.&lt;br /&gt;
&lt;br /&gt;
=== Clean imported raster DEM ===&lt;br /&gt;
&lt;br /&gt;
(fill holes)&lt;br /&gt;
&lt;br /&gt;
 # convert to vector points&lt;br /&gt;
 r.to.vect -z feature=point in=${BASEMAP}_Data out=${BASEMAP}_pt&lt;br /&gt;
 &lt;br /&gt;
 # interpolate using a regularized spline fit&lt;br /&gt;
 # this is very slow, but produces very high quality output&lt;br /&gt;
 v.surf.rst layer=0 in=${BASEMAP}_pt elev=${BASEMAP}.rst&lt;br /&gt;
 &lt;br /&gt;
 # create 5m buffer area around original data points&lt;br /&gt;
 r.buffer in=${BASEMAP}_Data out=${BASEMAP}.5m_buff dist=5&lt;br /&gt;
 &lt;br /&gt;
 # crop interpolated DEM to only include areas nearby actual data&lt;br /&gt;
 r.mapcalc &amp;quot;${BASEMAP}.filled = \&lt;br /&gt;
    if( isnull(${BASEMAP}.5m_buff), null(), ${BASEMAP}.rst)&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 # set colors to something nice&lt;br /&gt;
 r.colors ${BASEMAP}.filled color=bcyr -e&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Depending on your needs, {{cmd|r.fillnulls}}, {{cmd|v.surf.bspline}}, {{cmd|v.surf.idw}}, {{cmd|r.surf.idw}}, {{cmd|r.surf.idw2}}, or [[GRASS_AddOns#r.surf.nnbathy|r.surf.nnbathy]] may be faster than the {{cmd|v.surf.rst}} method.&lt;br /&gt;
&lt;br /&gt;
=== Visualize raster DEM in 3D ===&lt;br /&gt;
&lt;br /&gt;
 nviz ${BASEMAP}.filled&lt;br /&gt;
&lt;br /&gt;
* Set z-exag to 2.0&lt;br /&gt;
* In Visualize &amp;amp;rarr; Raster Surfaces set the fine (final) resolution to 1, and coarse (preview) resolution to 5.&lt;br /&gt;
* Set the height to 500.0, the perspective to 15.0, and drag the view-puck to the North-West and reasonably zoomed in.&lt;br /&gt;
: You should now be able to see the serpent:&lt;br /&gt;
&lt;br /&gt;
[[Image:LAS_serpent_nviz.jpg|thumb|center|400px|The Great Serpent Mound, Adams County, Ohio, USA]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
It is possible to show vector points in 3D, but millions of them may make the program run slow. Topology is required ({{cmd|v.build}}). Tick the &amp;quot;3D&amp;quot; box in the Visualize &amp;amp;rarr; Vector points dialog.&lt;br /&gt;
&lt;br /&gt;
=== LAS Export ===&lt;br /&gt;
&lt;br /&gt;
==== Export to LAS ====&lt;br /&gt;
&lt;br /&gt;
This is the reverse of the import step, but using {{cmd|v.out.ascii}} or {{cmd|r.out.xyz}} with ''txt2las''.&lt;br /&gt;
Because the v.out.ascii module exports category number which we are not interested in, we cut it away with the UNIX ''cut'' utility.&lt;br /&gt;
&lt;br /&gt;
 v.out.ascii ${BASEMAP}_pts fs=space | cut -f1-3 -d' ' \&lt;br /&gt;
     &amp;gt; ${BASEMAP}_export.txt&lt;br /&gt;
 &lt;br /&gt;
 txt2las --parse xyz -i ${BASEMAP}_export.txt&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Micro-tutorial for LIDAR data analysis ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Simple analysis of single return data ===&lt;br /&gt;
&lt;br /&gt;
Data source: North Carolina sample data set (Lidar data from 2001, near Raleigh, North Carolina). Download from&lt;br /&gt;
   http://www.grassbook.org/ncexternal/&lt;br /&gt;
   -&amp;gt; File: BE3720079200WC20020829m.txt 3.6M (lidar bare earth points [spm])&lt;br /&gt;
&lt;br /&gt;
Scan input file for spatial extent. The -g flag shows the result in a convenient copy-paste format for {{cmd|g.region}}:&lt;br /&gt;
   r.in.xyz BE3720079200WC20020829m.txt out=dummy -s -g&lt;br /&gt;
&lt;br /&gt;
We use this output to set region, predefine 2m raster cells, and polish the odd coordinates with -a:&lt;br /&gt;
   g.region n=222504.439000 s=219456.442000 e=640081.274000 w=637033.274000 res=2 -a -p&lt;br /&gt;
&lt;br /&gt;
==== QUESTION 1: Are these Lidar data sufficiently dense? ====&lt;br /&gt;
&lt;br /&gt;
We compute a raster map representing number of points per cell&lt;br /&gt;
   r.in.xyz BE3720079200WC20020829m.txt out=lid_792_binn2m method=n&lt;br /&gt;
&lt;br /&gt;
Look at the resulting raster map:&lt;br /&gt;
   d.mon x0&lt;br /&gt;
   d.font Vera&lt;br /&gt;
   d.rast.leg lid_792_binn2m&lt;br /&gt;
&lt;br /&gt;
Report point distribution in percent:&lt;br /&gt;
   r.report lid_792_binn2m unit=p&lt;br /&gt;
&lt;br /&gt;
Reduce the resolution to 6m to get at least one point per cell:&lt;br /&gt;
   g.region res=6 -a -p&lt;br /&gt;
   r.in.xyz BE3720079200WC20020829m.txt out=lid_792_binn6m method=n&lt;br /&gt;
   d.rast.leg lid_792_binn6m&lt;br /&gt;
   # ... a few holes remain but that's probably acceptable.&lt;br /&gt;
&lt;br /&gt;
Compute raster maps representing mean elevation for each cell:&lt;br /&gt;
   r.in.xyz BE3720079200WC20020829m.txt out=lid_792_binmean6m  \&lt;br /&gt;
            meth=mean&lt;br /&gt;
   d.rast.leg lid_792_binmean6m&lt;br /&gt;
&lt;br /&gt;
Compute range and variation:&lt;br /&gt;
   r.in.xyz BE3720079200WC20020829m.txt out=lid_792_binrange6m \&lt;br /&gt;
            meth=range&lt;br /&gt;
   d.rast.leg lid_792_binrange6m&lt;br /&gt;
   r.in.xyz BE3720079200WC20020829m.txt out=lid_792_binvar6m   \&lt;br /&gt;
            meth=coeff_var&lt;br /&gt;
   d.rast.leg lid_792_binvar6m&lt;br /&gt;
&lt;br /&gt;
Overlay other GIS maps to map of mean elevation:&lt;br /&gt;
   d.rast.leg lid_792_binmean6m&lt;br /&gt;
   d.vect streets_wake&lt;br /&gt;
   d.vect lakes type=boundary&lt;br /&gt;
   d.vect streams&lt;br /&gt;
&lt;br /&gt;
Now we continue to work in a zoomed spatial subset of the area.&lt;br /&gt;
&lt;br /&gt;
We import only points in the rural area without building topology and using z-coordinate for elevation:&lt;br /&gt;
   g.region rural_1m -p&lt;br /&gt;
   v.in.ascii -ztbr BE3720079200WC20020829m.txt \&lt;br /&gt;
              out=elev_lidrural_bepts z=3&lt;br /&gt;
&lt;br /&gt;
Clear monitor show black-white orthophoto:&lt;br /&gt;
   d.erase -f&lt;br /&gt;
   d.rast ortho_2001_t792_1m&lt;br /&gt;
&lt;br /&gt;
We now use already prepared Lidar vector point maps:&lt;br /&gt;
* elev_lid792_bepts:   Rural area (in tile 792), bare earth lidar point cloud&lt;br /&gt;
* elev_lidrural_mrpts: Rural area multiple return lidar point cloud&lt;br /&gt;
&lt;br /&gt;
Look at ground data:&lt;br /&gt;
d.vect elev_lidrural_bepts siz=2 col=red&lt;br /&gt;
&lt;br /&gt;
Look at &amp;quot;surface&amp;quot; data:&lt;br /&gt;
d.vect elev_lidrural_mrpts siz=1 col=green&lt;br /&gt;
&lt;br /&gt;
Visualize 3D Lidar multi-return points:&lt;br /&gt;
nviz elev_lid792_1m point=elev_lidrural_mrpts&lt;br /&gt;
 # Visualize -&amp;gt; Vector Points -&amp;gt; 3D points&lt;br /&gt;
 #                            -&amp;gt; Icon size 2.25&lt;br /&gt;
 #  --&amp;gt; GRASS book p. 253, fig. 3.15 (see also screenshot [http://www.grassbook.org/about_menu3rd.php here])&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== DEM/DSM separation the simple way by selection of Lidar returns ====&lt;br /&gt;
&lt;br /&gt;
Find out where we have multiple returns:&lt;br /&gt;
   d.rast ortho_2001_t792_1m&lt;br /&gt;
   d.vect elev_lidrural_mrpts where=&amp;quot;return=1&amp;quot; col=red siz=2&lt;br /&gt;
   d.vect elev_lidrural_mrpts where=&amp;quot;return=2&amp;quot; col=green siz=3&lt;br /&gt;
   d.vect elev_lidrural_mrpts where=&amp;quot;return=3&amp;quot; col=blue&lt;br /&gt;
   d.vect elev_lidrural_mrpts where=&amp;quot;return=4&amp;quot; col=yellow&lt;br /&gt;
&lt;br /&gt;
DTM: extract last return(s):&lt;br /&gt;
   v.extract elev_lidrural_mrpts out=elev_lidrural_mrpts_first where=&amp;quot;Return &amp;lt; 2&amp;quot;&lt;br /&gt;
   nviz elev_lid792_1m point=elev_lidrural_mrpts_first&lt;br /&gt;
&lt;br /&gt;
Interpolate to map and look at it:&lt;br /&gt;
   v.surf.rst elev_lidrural_mrpts_first layer=0 elev=elev_lidrural_mrpts_DTM&lt;br /&gt;
   nviz elev_lidrural_mrpts_DTM col=ortho_2001_t792_1m&lt;br /&gt;
&lt;br /&gt;
DSM: extract first return(s):&lt;br /&gt;
   v.extract elev_lidrural_mrpts out=elev_lidrural_mrpts_last where=&amp;quot;Return &amp;gt; 2&amp;quot;&lt;br /&gt;
   nviz elev_lid792_1m point=elev_lidrural_mrpts_last&lt;br /&gt;
&lt;br /&gt;
Interpolate to map and look at it:&lt;br /&gt;
   v.surf.rst elev_lidrural_mrpts_first layer=0 elev=elev_lidrural_mrpts_DSM&lt;br /&gt;
   nviz elev_lidrural_mrpts_DSM col=ortho_2001_t792_1m&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== DEM/DSM separation the more complex way ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;''TODO: verify order of first and last returns in below text''&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
General procedure:&lt;br /&gt;
* Lidar point clouds (first and last return) are imported with {{cmd|v.in.ascii}} (-b flag to not build the topology).&lt;br /&gt;
* Outlier detection is done with {{cmd|v.outlier}} on both first and last return data (NB currently a selection of &amp;lt;/=4 for soe/son in {{cmd|v.outlier}} results in an error message).&lt;br /&gt;
* Then, with {{cmd|v.lidar.edgedetection}}, edges are detected from last return data.&lt;br /&gt;
* The building are generated by {{cmd|v.lidar.growing}} from detected edges.&lt;br /&gt;
* The resulting data are post-processed with {{cmd|v.lidar.correction}}.&lt;br /&gt;
* Finally, the DTM and DSM are generated with {{cmd|v.surf.bspline}} (DTM: uses the 'v.lidar.correction' output; DSM: uses last return output from outlier detection).&lt;br /&gt;
* NB for {{cmd|v.outlier}}, {{cmd|v.lidar.edgedetection}} and {{cmd|v.surf.bspline}}, one spline steps equates to 1m. It is recommended as a starting point that the choice of spline step is roughly 3 or 4 times the planimetric resolution (potential grid resolution) of your data. Experiment from there to obtain better results.&lt;br /&gt;
&lt;br /&gt;
  export GRASS_OVERWRITE=1&lt;br /&gt;
  v.extract elev_lidrural_mrpts out=elev_lidfirst_pts \&lt;br /&gt;
            where=&amp;quot;return = 1&amp;quot;&lt;br /&gt;
  v.extract elev_lidrural_mrpts out=elev_lidlast_pts  \&lt;br /&gt;
            where=&amp;quot;return &amp;gt;= 2&amp;quot;&lt;br /&gt;
  d.vect elev_lidfirst_pts col=red&lt;br /&gt;
  d.vect elev_lidlast_pts col=green&lt;br /&gt;
&lt;br /&gt;
Outlier detection and separation into two maps&lt;br /&gt;
  # 1st return&lt;br /&gt;
  v.outlier elev_lidfirst_pts output=elev_lidfirst_clean \&lt;br /&gt;
            outlier=elev_lidfirst_outl&lt;br /&gt;
  d.erase&lt;br /&gt;
  d.vect elev_lidfirst_clean siz=2&lt;br /&gt;
  d.vect elev_lidfirst_outl col=red&lt;br /&gt;
&lt;br /&gt;
2nd return&lt;br /&gt;
  v.outlier elev_lidlast_pts output=elev_lidlast_clean \&lt;br /&gt;
            outlier=elev_lidlast_outl&lt;br /&gt;
  d.erase&lt;br /&gt;
  d.vect elev_lidlast_clean siz=2&lt;br /&gt;
  d.vect elev_lidlast_outl col=red&lt;br /&gt;
  # -&amp;gt; no outliers visible&lt;br /&gt;
&lt;br /&gt;
Run an edge detection on cleaned last return:&lt;br /&gt;
  v.lidar.edgedetection elev_lidlast_clean \&lt;br /&gt;
                        out=elev_lidlast_edges&lt;br /&gt;
&lt;br /&gt;
Buildings/vegetation are generated from detected edges (bug: you may need to specify the mapset):&lt;br /&gt;
  v.lidar.growing elev_lidlast_edges@lidar out=elev_lidlast_grow \&lt;br /&gt;
                  first=elev_lidfirst_clean&lt;br /&gt;
&lt;br /&gt;
Compare:&lt;br /&gt;
  d.vect elev_lidlast_pts col=blue&lt;br /&gt;
  d.vect elev_lidlast_grow col=green&lt;br /&gt;
&lt;br /&gt;
Correction (this is applied twice):&lt;br /&gt;
  v.lidar.correction elev_lidlast_grow out=elev_lidlast_corr1 \&lt;br /&gt;
                     terrain=elev_lidlast_terr1&lt;br /&gt;
  v.lidar.correction elev_lidlast_corr1 out=elev_lid_dsm \&lt;br /&gt;
                     terrain=elev_lid_dtm&lt;br /&gt;
&lt;br /&gt;
DEM and DSM are generated:&lt;br /&gt;
  # Estimation of lambda_i parameter with cross validation (watch for RMS!)&lt;br /&gt;
  # and note use of bicubic for DSM and bilinear for DTM here and below&lt;br /&gt;
  v.surf.bspline -c elev_lid_dsm sie=100 sin=100 type=bicubic&lt;br /&gt;
  v.surf.bspline -c elev_lid_dtm sie=100 sin=100 type=bilinear&lt;br /&gt;
  &lt;br /&gt;
  # From the cross-validation, we select lambda with minimal RMS error:&lt;br /&gt;
  # generate raster surfaces at 1m resolution &lt;br /&gt;
  v.surf.bspline elev_lid_dsm raster=lidar_dsm lambda=0.1 type=bicubic&lt;br /&gt;
  v.surf.bspline elev_lid_dtm raster=lidar_dtm lambda=0.0001 type=bilinear&lt;br /&gt;
  &lt;br /&gt;
  d.rast lidar_dsm&lt;br /&gt;
  d.rast lidar_dtm&lt;br /&gt;
  &lt;br /&gt;
  nviz lidar_dsm,lidar_dtm \&lt;br /&gt;
       col=ortho_2001_t792_1m,ortho_2001_t792_1m&lt;br /&gt;
&lt;br /&gt;
...with the position slider you can visually separate DSM and DEM, increase z slider (Visualize -&amp;gt; Raster Surface -&amp;gt; Position).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Windows users (6.4.x only?):'''&lt;br /&gt;
* When using the DBF driver (default) it is necessary to manually create the DBF table prior to importing points with {{cmd|v.in.ascii}}:&lt;br /&gt;
  # Manually connect the DBF table&lt;br /&gt;
  db.connect driver=dbf database='$GISDBASE/$LOCATION_NAME/$MAPSET/dbf&lt;br /&gt;
  &lt;br /&gt;
  # Display the connection (has to be a separate command and run or the connection does not work)&lt;br /&gt;
  db.connect -p&lt;br /&gt;
&lt;br /&gt;
== Sample LIDAR data ==&lt;br /&gt;
&lt;br /&gt;
=== Widely used in GRASS tutorials ===&lt;br /&gt;
&lt;br /&gt;
* [http://www.grassbook.org/data_menu2nd.php Jockey's Ridge, NC, LIDAR dataset]&lt;br /&gt;
* [http://www.grassbook.org/data_menu3rd.php North Carolina OSGeo Edu data set] (includes multi-return LIDAR data)&lt;br /&gt;
&lt;br /&gt;
=== Other ===&lt;br /&gt;
&lt;br /&gt;
* United States Antarctic Resource Center: LIDAR High-resolution DEM Final DATA Downloads&amp;lt;BR&amp;gt;http://usarc.usgs.gov/lidar_dload.shtml&lt;br /&gt;
&lt;br /&gt;
* LIDAR ALSM Research, Arizona State University Ative Tectonics, Research Group&amp;lt;BR&amp;gt;  http://lidar.asu.edu/research.html and http://www.geongrid.org/science/lidar.html&lt;br /&gt;
&lt;br /&gt;
* USGS Center for LIDAR Information Coordination and Knowledge (aka CLICK) - USGS LiDAR point cloud distribution site&amp;lt;BR&amp;gt; http://lidar.cr.usgs.gov&lt;br /&gt;
&lt;br /&gt;
* Washington State Geospatial Data Archive, Mount Saint Helens - Lidar Data &amp;lt;BR&amp;gt;https://wagda.lib.washington.edu/data/type/elevation/lidar/st_helens/&lt;br /&gt;
&lt;br /&gt;
* Puget Sound Lidar Consortium, public-domain high-resolution topography for western Washington&amp;lt;BR&amp;gt;http://pugetsoundlidar.ess.washington.edu/index.htm&lt;br /&gt;
&lt;br /&gt;
* NOAA Topographic Change Mapping LIDAR Data Retrieval Tool (LDART) NOAA Coastal Services Center&amp;lt;BR&amp;gt;http://maps.csc.noaa.gov/TCM/&lt;br /&gt;
&lt;br /&gt;
* Landmap, LIDAR Data from the Environment Agency &amp;lt;BR&amp;gt;http://www.landmap.ac.uk/lidar/lidar.html&lt;br /&gt;
&lt;br /&gt;
* Northern California LIDAR data &amp;lt;BR&amp;gt;http://quake.usgs.gov/research/geology/lidar/  and http://core2.gsfc.nasa.gov/lidar/terrapoint/&lt;br /&gt;
&lt;br /&gt;
* IDAHO GEOSPATIAL , Bare Earth LIDAR DEM Download - UTM &amp;lt;BR&amp;gt;http://inside.uidaho.edu/geodata/LiDAR/LiDARBareEarthDEM_DownloadUTM.htm&lt;br /&gt;
&lt;br /&gt;
* EarthScope Spatial Data Explorer - A java application for querying, browsing, and acquiring data from the EarthScope Spatial Data Repository. Currently includes a number of LiDAR datasets. &amp;lt;BR&amp;gt;http://www.earthscope.org/data/lidar.php&lt;br /&gt;
&lt;br /&gt;
* LIDAR Galley &amp;lt;BR&amp;gt;https://peoiewswebinfo.monmouth.army.mil/JPSD/LIDAR_Gallery.htm&lt;br /&gt;
&lt;br /&gt;
* South Tyrol - Download of DTMs (Homepage in German or Italian) &amp;lt;BR&amp;gt; http://www.provinz.bz.it/raumordnung/grundkarten/utm/default_d.htm&lt;br /&gt;
&lt;br /&gt;
== Links ==&lt;br /&gt;
&lt;br /&gt;
* [http://liblas.org/ libLAS] - LAS 1.0/1.1 ASPRS LiDAR data translation toolset&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>⚠️John Tate</name></author>
	</entry>
	<entry>
		<id>https://grasswiki.osgeo.org/w/index.php?title=LIDAR&amp;diff=9862</id>
		<title>LIDAR</title>
		<link rel="alternate" type="text/html" href="https://grasswiki.osgeo.org/w/index.php?title=LIDAR&amp;diff=9862"/>
		<updated>2009-11-05T15:55:11Z</updated>

		<summary type="html">&lt;p&gt;⚠️John Tate: /* DEM/DSM separation the more complex way */ addition of bicubic and bilinear commands in v.surf.spline section&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;h1&amp;gt; LIDAR and Multi-beam Swath bathymetry data &amp;lt;/h1&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Modules ==&lt;br /&gt;
&lt;br /&gt;
=== Import ===&lt;br /&gt;
&lt;br /&gt;
* {{cmd|r.in.xyz}} - Create a raster map from an assemblage of many coordinates using univariate statistics. ([http://hamish.bowman.googlepages.com/grassfiles#xyz example])&lt;br /&gt;
&lt;br /&gt;
* {{cmd|v.in.ascii}} - Import data from an ASCII file to GRASS vector format.&lt;br /&gt;
: ''Due to memory overhead vector point imports will be limited to a few million data points unless topology and database creation is skipped with the '''-bt''' flags''. It may also be useful to clip the import file to only accept points falling within the current region by using the '''-r''' flag. See {{cmd|g.region}} for details on specifying the region bounds.&lt;br /&gt;
&lt;br /&gt;
=== Analysis ===&lt;br /&gt;
&lt;br /&gt;
* {{cmd|v.outlier}} - Removes outliers from vector point data.&lt;br /&gt;
&lt;br /&gt;
* {{cmd|v.lidar.edgedetection}} - Detect the object's edges from a LIDAR data set.&lt;br /&gt;
&lt;br /&gt;
* {{cmd|v.lidar.growing}} - Building contour determination and Region Growing algorithm for determining the building inside.&lt;br /&gt;
&lt;br /&gt;
* {{cmd|v.lidar.correction}} - Correction of the v.lidar.growing output. It is the last of the three algorithms for LIDAR filtering.&lt;br /&gt;
&lt;br /&gt;
=== Surface generation ===&lt;br /&gt;
&lt;br /&gt;
* {{cmd|v.surf.rst}} - Spatial approximation and topographic analysis using regularized spline with tension.&lt;br /&gt;
&lt;br /&gt;
* {{cmd|v.surf.idw}} - Surface interpolation from vector point data by Inverse Distance Squared Weighting.&lt;br /&gt;
&lt;br /&gt;
* {{cmd|v.surf.bspline}} - Surface interpolation from vector point data by bicubic or bilineal interpolation with Tykhonov regularization.&lt;br /&gt;
&lt;br /&gt;
* {{cmd|r.fillnulls}} - Fills no-data areas in raster maps using v.surf.rst splines interpolation.&lt;br /&gt;
&lt;br /&gt;
== Swath Bathymetry Tools ==&lt;br /&gt;
&lt;br /&gt;
''see also the [[Marine_Science#Multibeam_sonar_processing]] wiki page''&lt;br /&gt;
&lt;br /&gt;
* The [http://david.p.finlayson.googlepages.com/swathwidth v.swathwidith] module by David Finlayson for planning surveys. (development page)&lt;br /&gt;
&lt;br /&gt;
* An example of [http://bambi.otago.ac.nz/hamish/grass/gdal/sidescan_warp.html post-processing scanned paper sidescan swaths] using thin plate spline warping with [http://www.gdal.org/ GDAL's] &amp;quot;&amp;lt;tt&amp;gt;gdalwarp -tps&amp;lt;/tt&amp;gt;&amp;quot; function. (debugging page)&lt;br /&gt;
&lt;br /&gt;
* [[Marine_Science#Import_into_GRASS|GRASS integration]] with [http://www.ldeo.columbia.edu/res/pi/MB-System/ MB-System] (GPL) software for processing Multibeam and Sidescan Sonar data. GRASS + MBsys + [[GMT]] make a nice scriptable trio.&lt;br /&gt;
&lt;br /&gt;
== LIDAR Tools ==&lt;br /&gt;
&lt;br /&gt;
*  {{cmd|r.terraflow}} - computation of flow direction, flow accumulation and other basic topographic terrain indices from massive raster digital elevation models (DEM). From the Duke University [http://terrain.cs.duke.edu/ STREAM] project.&lt;br /&gt;
&lt;br /&gt;
* [http://mpa.itc.it/markus/grass61/demos/rlake/ Flood simulation] using {{cmd|r.lake}}. Includes fancy NVIZ visualization of Trento, Italy, by Markus Neteler.&lt;br /&gt;
&lt;br /&gt;
* [http://www.cs.unc.edu/~isenburg/software/ LAStools] are a set of simple command line tools  (including source code) for converting to/from ASCII, viewing, comparing, and compressing LIDAR data.&lt;br /&gt;
&lt;br /&gt;
* [http://www.liblas.org libLAS] ASPRS LiDAR data translation tools&lt;br /&gt;
&lt;br /&gt;
* See also [[LIDAR#Analysis|LIDAR Analysis]]&lt;br /&gt;
&lt;br /&gt;
== Micro-tutorial for LAS data==&lt;br /&gt;
&lt;br /&gt;
=== Preparation ===&lt;br /&gt;
&lt;br /&gt;
==== Conversion of text files to LAS ====&lt;br /&gt;
&lt;br /&gt;
[http://www.liblas.org/ libLAS] supports the following column types:&lt;br /&gt;
   x - x coordinate&lt;br /&gt;
   y - y coordinate&lt;br /&gt;
   z - z coordinate&lt;br /&gt;
   a - scan angle&lt;br /&gt;
   i - intensity&lt;br /&gt;
   n - number of returns for given pulse (1..n)&lt;br /&gt;
   r - number of this return (1..r)&lt;br /&gt;
   c - classification&lt;br /&gt;
   u - user data (but only 1 byte)&lt;br /&gt;
   p - point source ID&lt;br /&gt;
   e - edge of flight line&lt;br /&gt;
   d - direction of scan flag&lt;br /&gt;
   t - GPS time&lt;br /&gt;
   s - skip column&lt;br /&gt;
&lt;br /&gt;
Sample text data such as:&lt;br /&gt;
   returntime,pulse,east,north,height,intensity,stripe&lt;br /&gt;
   549778.907200,1,673999.940,5099680.080,507.425,20.0,45105&lt;br /&gt;
   ...&lt;br /&gt;
&lt;br /&gt;
can be converted to LAS format like this:&lt;br /&gt;
   returntime - t&lt;br /&gt;
   pulse - r&lt;br /&gt;
   east - x&lt;br /&gt;
   north - y&lt;br /&gt;
   height - z&lt;br /&gt;
   intensity - i&lt;br /&gt;
   stripe - s&lt;br /&gt;
&lt;br /&gt;
First parse (sanity check):&lt;br /&gt;
   txt2las -parse trxyzis data.asc&lt;br /&gt;
&lt;br /&gt;
Then convert:&lt;br /&gt;
   txt2las -parse trxyzis -i data.asc -o data.las &lt;br /&gt;
&lt;br /&gt;
While you may not need to do this conversion for GRASS import, the resulting files are way smaller than the uncompressed text files; additionally, they are in a defined format.&lt;br /&gt;
&lt;br /&gt;
=== LAS Import ===&lt;br /&gt;
&lt;br /&gt;
* Use the [http://www.liblas.org libLAS] utilities to import LAS data into GRASS. &lt;br /&gt;
* Data stored in text files can generally be imported directly into GRASS.&lt;br /&gt;
&lt;br /&gt;
* The data used in the rest of this micro-tutorial can be found at [http://www.appliedimagery.com/Serpent%20Mound%20Model%20LAS%20Data.las appliedimagery.com].&lt;br /&gt;
&lt;br /&gt;
==== Import LAS as raster DEM ====&lt;br /&gt;
&lt;br /&gt;
Check bounds and SRS:&lt;br /&gt;
 $ lasinfo &amp;quot;Serpent_Mound_Model_LAS_Data.las&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
  [...]&lt;br /&gt;
  Min X Y Z                  289020.900000 4320942.610000 166.780000&lt;br /&gt;
  Max X Y Z                  290106.020000 4323641.570000 215.480000&lt;br /&gt;
 Spatial Reference           +proj=utm +zone=17 +ellps=WGS84 +units=m &lt;br /&gt;
&lt;br /&gt;
After creating a suitable UTM zone 17 location (EPSG:32617) &lt;br /&gt;
set the region according to the information from lasinfo at 1m resolution, rounding grid outwards to align to whole meters:&lt;br /&gt;
 GRASS&amp;gt; {{cmd|g.region}} n=4323641.57 s=4320942.61 w=289020.90 e=290106.02 res=1 -ap&lt;br /&gt;
&lt;br /&gt;
Finally, import with {{cmd|r.in.xyz}} with data piped directly from the &amp;lt;tt&amp;gt;las2txt&amp;lt;/tt&amp;gt; program and set a nice equalized color table:&lt;br /&gt;
 BASEMAP=&amp;quot;Serpent_Mound_Model_LAS&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 las2txt --stdout &amp;quot;${BASEMAP}_Data.las&amp;quot; | \&lt;br /&gt;
    r.in.xyz in=- out=${BASEMAP}_Data fs=space method=mean&lt;br /&gt;
 &lt;br /&gt;
 {{cmd|r.colors}} ${BASEMAP}_Data color=bcyr -e&lt;br /&gt;
&lt;br /&gt;
The above example uses the default z-elevation level as the 3rd term, but by using the &amp;lt;tt&amp;gt;las2txt --parse&amp;lt;/tt&amp;gt; command other fields (such as intensity) can be imported instead via &amp;quot;&amp;lt;tt&amp;gt;--parse xyi&amp;lt;/tt&amp;gt;&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
==== Import LAS as vector points ====&lt;br /&gt;
&lt;br /&gt;
Region setting (establishing the grid) is not needed for vector features so we can go directly to the import step. To deal with millions of input points {{cmd|v.in.ascii}} should be run with the options to skip creation of an attribute database and building topology as these can consume large amounts of memory. Note that vector maps without topology built are somewhat limited in their ability to be processed. Most LIDAR specific modules have been adapted to not require &lt;br /&gt;
topology. Even so, after initial cleaning steps it is often more efficient to work with huge datasets in GRASS as raster data.&lt;br /&gt;
&lt;br /&gt;
 las2txt --stdout &amp;quot;${BASEMAP}_Data.las&amp;quot; | \&lt;br /&gt;
   v.in.ascii -tbz z=3 out=&amp;quot;${BASEMAP}_pts&amp;quot; fs=space&lt;br /&gt;
&lt;br /&gt;
If topology was built, you can use {{cmd|d.vect}}'s -z flag to colorize by elevation value. Without topology you can still colorize, but you need to use color rules based on absolute elevations, not percentage of scale.&lt;br /&gt;
&amp;lt;!-- need an absolute color map gradiated across the elev range --&amp;gt;&lt;br /&gt;
 # display colorized points for data with built topology&lt;br /&gt;
 d.vect map=lidar_pts size=1 -z zcolor=elevation&lt;br /&gt;
&lt;br /&gt;
* After import as points you can then use the v.lidar tools to clean the data: {{cmd|v.lidar.correction}}, {{cmd|v.lidar.edgedetection}}, {{cmd|v.lidar.growing}}, and {{cmd|v.outlier}}.&lt;br /&gt;
&lt;br /&gt;
* Vector points can be interpolated into raster DEMs with a number of modules, including {{cmd|v.surf.rst}}, {{cmd|v.surf.bspline}}, and {{cmd|v.surf.idw}}.&lt;br /&gt;
&lt;br /&gt;
=== Clean imported raster DEM ===&lt;br /&gt;
&lt;br /&gt;
(fill holes)&lt;br /&gt;
&lt;br /&gt;
 # convert to vector points&lt;br /&gt;
 r.to.vect -z feature=point in=${BASEMAP}_Data out=${BASEMAP}_pt&lt;br /&gt;
 &lt;br /&gt;
 # interpolate using a regularized spline fit&lt;br /&gt;
 # this is very slow, but produces very high quality output&lt;br /&gt;
 v.surf.rst layer=0 in=${BASEMAP}_pt elev=${BASEMAP}.rst&lt;br /&gt;
 &lt;br /&gt;
 # create 5m buffer area around original data points&lt;br /&gt;
 r.buffer in=${BASEMAP}_Data out=${BASEMAP}.5m_buff dist=5&lt;br /&gt;
 &lt;br /&gt;
 # crop interpolated DEM to only include areas nearby actual data&lt;br /&gt;
 r.mapcalc &amp;quot;${BASEMAP}.filled = \&lt;br /&gt;
    if( isnull(${BASEMAP}.5m_buff), null(), ${BASEMAP}.rst)&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 # set colors to something nice&lt;br /&gt;
 r.colors ${BASEMAP}.filled color=bcyr -e&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Depending on your needs, {{cmd|r.fillnulls}}, {{cmd|v.surf.bspline}}, {{cmd|v.surf.idw}}, {{cmd|r.surf.idw}}, {{cmd|r.surf.idw2}}, or [[GRASS_AddOns#r.surf.nnbathy|r.surf.nnbathy]] may be faster than the {{cmd|v.surf.rst}} method.&lt;br /&gt;
&lt;br /&gt;
=== Visualize raster DEM in 3D ===&lt;br /&gt;
&lt;br /&gt;
 nviz ${BASEMAP}.filled&lt;br /&gt;
&lt;br /&gt;
* Set z-exag to 2.0&lt;br /&gt;
* In Visualize &amp;amp;rarr; Raster Surfaces set the fine (final) resolution to 1, and coarse (preview) resolution to 5.&lt;br /&gt;
* Set the height to 500.0, the perspective to 15.0, and drag the view-puck to the North-West and reasonably zoomed in.&lt;br /&gt;
: You should now be able to see the serpent:&lt;br /&gt;
&lt;br /&gt;
[[Image:LAS_serpent_nviz.jpg|thumb|center|400px|The Great Serpent Mound, Adams County, Ohio, USA]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
It is possible to show vector points in 3D, but millions of them may make the program run slow. Topology is required ({{cmd|v.build}}). Tick the &amp;quot;3D&amp;quot; box in the Visualize &amp;amp;rarr; Vector points dialog.&lt;br /&gt;
&lt;br /&gt;
=== LAS Export ===&lt;br /&gt;
&lt;br /&gt;
==== Export to LAS ====&lt;br /&gt;
&lt;br /&gt;
This is the reverse of the import step, but using {{cmd|v.out.ascii}} or {{cmd|r.out.xyz}} with ''txt2las''.&lt;br /&gt;
Because the v.out.ascii module exports category number which we are not interested in, we cut it away with the UNIX ''cut'' utility.&lt;br /&gt;
&lt;br /&gt;
 v.out.ascii ${BASEMAP}_pts fs=space | cut -f1-3 -d' ' \&lt;br /&gt;
     &amp;gt; ${BASEMAP}_export.txt&lt;br /&gt;
 &lt;br /&gt;
 txt2las --parse xyz -i ${BASEMAP}_export.txt&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Micro-tutorial for LIDAR data analysis ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Simple analysis of single return data ===&lt;br /&gt;
&lt;br /&gt;
Data source: North Carolina sample data set (Lidar data from 2001, near Raleigh, North Carolina). Download from&lt;br /&gt;
   http://www.grassbook.org/ncexternal/&lt;br /&gt;
   -&amp;gt; File: BE3720079200WC20020829m.txt 3.6M (lidar bare earth points [spm])&lt;br /&gt;
&lt;br /&gt;
Scan input file for spatial extent. The -g flag shows the result in a convenient copy-paste format for {{cmd|g.region}}:&lt;br /&gt;
   r.in.xyz BE3720079200WC20020829m.txt out=dummy -s -g&lt;br /&gt;
&lt;br /&gt;
We use this output to set region, predefine 2m raster cells, and polish the odd coordinates with -a:&lt;br /&gt;
   g.region n=222504.439000 s=219456.442000 e=640081.274000 w=637033.274000 res=2 -a -p&lt;br /&gt;
&lt;br /&gt;
==== QUESTION 1: Are these Lidar data sufficiently dense? ====&lt;br /&gt;
&lt;br /&gt;
We compute a raster map representing number of points per cell&lt;br /&gt;
   r.in.xyz BE3720079200WC20020829m.txt out=lid_792_binn2m method=n&lt;br /&gt;
&lt;br /&gt;
Look at the resulting raster map:&lt;br /&gt;
   d.mon x0&lt;br /&gt;
   d.font Vera&lt;br /&gt;
   d.rast.leg lid_792_binn2m&lt;br /&gt;
&lt;br /&gt;
Report point distribution in percent:&lt;br /&gt;
   r.report lid_792_binn2m unit=p&lt;br /&gt;
&lt;br /&gt;
Reduce the resolution to 6m to get at least one point per cell:&lt;br /&gt;
   g.region res=6 -a -p&lt;br /&gt;
   r.in.xyz BE3720079200WC20020829m.txt out=lid_792_binn6m method=n&lt;br /&gt;
   d.rast.leg lid_792_binn6m&lt;br /&gt;
   # ... a few holes remain but that's probably acceptable.&lt;br /&gt;
&lt;br /&gt;
Compute raster maps representing mean elevation for each cell:&lt;br /&gt;
   r.in.xyz BE3720079200WC20020829m.txt out=lid_792_binmean6m  \&lt;br /&gt;
            meth=mean&lt;br /&gt;
   d.rast.leg lid_792_binmean6m&lt;br /&gt;
&lt;br /&gt;
Compute range and variation:&lt;br /&gt;
   r.in.xyz BE3720079200WC20020829m.txt out=lid_792_binrange6m \&lt;br /&gt;
            meth=range&lt;br /&gt;
   d.rast.leg lid_792_binrange6m&lt;br /&gt;
   r.in.xyz BE3720079200WC20020829m.txt out=lid_792_binvar6m   \&lt;br /&gt;
            meth=coeff_var&lt;br /&gt;
   d.rast.leg lid_792_binvar6m&lt;br /&gt;
&lt;br /&gt;
Overlay other GIS maps to map of mean elevation:&lt;br /&gt;
   d.rast.leg lid_792_binmean6m&lt;br /&gt;
   d.vect streets_wake&lt;br /&gt;
   d.vect lakes type=boundary&lt;br /&gt;
   d.vect streams&lt;br /&gt;
&lt;br /&gt;
Now we continue to work in a zoomed spatial subset of the area.&lt;br /&gt;
&lt;br /&gt;
We import only points in the rural area without building topology and using z-coordinate for elevation:&lt;br /&gt;
   g.region rural_1m -p&lt;br /&gt;
   v.in.ascii -ztbr BE3720079200WC20020829m.txt \&lt;br /&gt;
              out=elev_lidrural_bepts z=3&lt;br /&gt;
&lt;br /&gt;
Clear monitor show black-white orthophoto:&lt;br /&gt;
   d.erase -f&lt;br /&gt;
   d.rast ortho_2001_t792_1m&lt;br /&gt;
&lt;br /&gt;
We now use already prepared Lidar vector point maps:&lt;br /&gt;
* elev_lid792_bepts:   Rural area (in tile 792), bare earth lidar point cloud&lt;br /&gt;
* elev_lidrural_mrpts: Rural area multiple return lidar point cloud&lt;br /&gt;
&lt;br /&gt;
Look at ground data:&lt;br /&gt;
d.vect elev_lidrural_bepts siz=2 col=red&lt;br /&gt;
&lt;br /&gt;
Look at &amp;quot;surface&amp;quot; data:&lt;br /&gt;
d.vect elev_lidrural_mrpts siz=1 col=green&lt;br /&gt;
&lt;br /&gt;
Visualize 3D Lidar multi-return points:&lt;br /&gt;
nviz elev_lid792_1m point=elev_lidrural_mrpts&lt;br /&gt;
 # Visualize -&amp;gt; Vector Points -&amp;gt; 3D points&lt;br /&gt;
 #                            -&amp;gt; Icon size 2.25&lt;br /&gt;
 #  --&amp;gt; GRASS book p. 253, fig. 3.15 (see also screenshot [http://www.grassbook.org/about_menu3rd.php here])&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== DEM/DSM separation the simple way by selection of Lidar returns ====&lt;br /&gt;
&lt;br /&gt;
Find out where we have multiple returns:&lt;br /&gt;
   d.rast ortho_2001_t792_1m&lt;br /&gt;
   d.vect elev_lidrural_mrpts where=&amp;quot;return=1&amp;quot; col=red siz=2&lt;br /&gt;
   d.vect elev_lidrural_mrpts where=&amp;quot;return=2&amp;quot; col=green siz=3&lt;br /&gt;
   d.vect elev_lidrural_mrpts where=&amp;quot;return=3&amp;quot; col=blue&lt;br /&gt;
   d.vect elev_lidrural_mrpts where=&amp;quot;return=4&amp;quot; col=yellow&lt;br /&gt;
&lt;br /&gt;
DTM: extract last return(s):&lt;br /&gt;
   v.extract elev_lidrural_mrpts out=elev_lidrural_mrpts_first where=&amp;quot;Return &amp;lt; 2&amp;quot;&lt;br /&gt;
   nviz elev_lid792_1m point=elev_lidrural_mrpts_first&lt;br /&gt;
&lt;br /&gt;
Interpolate to map and look at it:&lt;br /&gt;
   v.surf.rst elev_lidrural_mrpts_first layer=0 elev=elev_lidrural_mrpts_DTM&lt;br /&gt;
   nviz elev_lidrural_mrpts_DTM col=ortho_2001_t792_1m&lt;br /&gt;
&lt;br /&gt;
DSM: extract first return(s):&lt;br /&gt;
   v.extract elev_lidrural_mrpts out=elev_lidrural_mrpts_last where=&amp;quot;Return &amp;gt; 2&amp;quot;&lt;br /&gt;
   nviz elev_lid792_1m point=elev_lidrural_mrpts_last&lt;br /&gt;
&lt;br /&gt;
Interpolate to map and look at it:&lt;br /&gt;
   v.surf.rst elev_lidrural_mrpts_first layer=0 elev=elev_lidrural_mrpts_DSM&lt;br /&gt;
   nviz elev_lidrural_mrpts_DSM col=ortho_2001_t792_1m&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== DEM/DSM separation the more complex way ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;''TODO: verify order of first and last returns in below text''&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
General procedure:&lt;br /&gt;
* Lidar point clouds (first and last return) are imported with {{cmd|v.in.ascii}} (-b flag to not build the topology).&lt;br /&gt;
* Outlier detection is done with {{cmd|v.outlier}} on both first and last return data (NB currently a selection of &amp;lt;/=4 for soe/son in {{cmd|v.outlier}} results in an error message).&lt;br /&gt;
* Then, with {{cmd|v.lidar.edgedetection}}, edges are detected from last return data.&lt;br /&gt;
* The building are generated by {{cmd|v.lidar.growing}} from detected edges.&lt;br /&gt;
* The resulting data are post-processed with {{cmd|v.lidar.correction}}.&lt;br /&gt;
* Finally, the DTM and DSM are generated with {{cmd|v.surf.bspline}} (DTM: uses the 'v.lidar.correction' output; DSM: uses last return output from outlier detection).&lt;br /&gt;
* NB for {{cmd|v.outlier}}, {{cmd|v.lidar.edgedetection}} and {{cmd|v.surf.bspline}}, one spline steps equates to 1m. It is recommend as a starting point that the choice of spline step is roughly 3 or 4 times the planimetric resolution (potential grid resolution) of your data. Experiment from there to obtain better results.&lt;br /&gt;
&lt;br /&gt;
  export GRASS_OVERWRITE=1&lt;br /&gt;
  v.extract elev_lidrural_mrpts out=elev_lidfirst_pts \&lt;br /&gt;
            where=&amp;quot;return = 1&amp;quot;&lt;br /&gt;
  v.extract elev_lidrural_mrpts out=elev_lidlast_pts  \&lt;br /&gt;
            where=&amp;quot;return &amp;gt;= 2&amp;quot;&lt;br /&gt;
  d.vect elev_lidfirst_pts col=red&lt;br /&gt;
  d.vect elev_lidlast_pts col=green&lt;br /&gt;
&lt;br /&gt;
Outlier detection and separation into two maps&lt;br /&gt;
  # 1st return&lt;br /&gt;
  v.outlier elev_lidfirst_pts output=elev_lidfirst_clean \&lt;br /&gt;
            outlier=elev_lidfirst_outl&lt;br /&gt;
  d.erase&lt;br /&gt;
  d.vect elev_lidfirst_clean siz=2&lt;br /&gt;
  d.vect elev_lidfirst_outl col=red&lt;br /&gt;
&lt;br /&gt;
2nd return&lt;br /&gt;
  v.outlier elev_lidlast_pts output=elev_lidlast_clean \&lt;br /&gt;
            outlier=elev_lidlast_outl&lt;br /&gt;
  d.erase&lt;br /&gt;
  d.vect elev_lidlast_clean siz=2&lt;br /&gt;
  d.vect elev_lidlast_outl col=red&lt;br /&gt;
  # -&amp;gt; no outliers visible&lt;br /&gt;
&lt;br /&gt;
Run an edge detection on cleaned last return:&lt;br /&gt;
  v.lidar.edgedetection elev_lidlast_clean \&lt;br /&gt;
                        out=elev_lidlast_edges&lt;br /&gt;
&lt;br /&gt;
Buildings/vegetation are generated from detected edges (bug: you may need to specify the mapset):&lt;br /&gt;
  v.lidar.growing elev_lidlast_edges@lidar out=elev_lidlast_grow \&lt;br /&gt;
                  first=elev_lidfirst_clean&lt;br /&gt;
&lt;br /&gt;
Compare:&lt;br /&gt;
  d.vect elev_lidlast_pts col=blue&lt;br /&gt;
  d.vect elev_lidlast_grow col=green&lt;br /&gt;
&lt;br /&gt;
Correction (this is applied twice):&lt;br /&gt;
  v.lidar.correction elev_lidlast_grow out=elev_lidlast_corr1 \&lt;br /&gt;
                     terrain=elev_lidlast_terr1&lt;br /&gt;
  v.lidar.correction elev_lidlast_corr1 out=elev_lid_dsm \&lt;br /&gt;
                     terrain=elev_lid_dtm&lt;br /&gt;
&lt;br /&gt;
DEM and DSM are generated:&lt;br /&gt;
  # Estimation of lambda_i parameter with cross validation (watch for RMS!)&lt;br /&gt;
  # and note use of bicubic for DSM and bilinear for DTM here and below&lt;br /&gt;
  v.surf.bspline -c elev_lid_dsm sie=100 sin=100 type=bicubic&lt;br /&gt;
  v.surf.bspline -c elev_lid_dtm sie=100 sin=100 type=bilinear&lt;br /&gt;
  &lt;br /&gt;
  # From the cross-validation, we select lambda with minimal RMS error:&lt;br /&gt;
  # generate raster surfaces at 1m resolution &lt;br /&gt;
  v.surf.bspline elev_lid_dsm raster=lidar_dsm lambda=0.1 type=bicubic&lt;br /&gt;
  v.surf.bspline elev_lid_dtm raster=lidar_dtm lambda=0.0001 type=bilinear&lt;br /&gt;
  &lt;br /&gt;
  d.rast lidar_dsm&lt;br /&gt;
  d.rast lidar_dtm&lt;br /&gt;
  &lt;br /&gt;
  nviz lidar_dsm,lidar_dtm \&lt;br /&gt;
       col=ortho_2001_t792_1m,ortho_2001_t792_1m&lt;br /&gt;
&lt;br /&gt;
...with the position slider you can visually separate DSM and DEM, increase z slider (Visualize -&amp;gt; Raster Surface -&amp;gt; Position).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Windows users (6.4.x only?):'''&lt;br /&gt;
* When using the DBF driver (default) it is necessary to manually create the DBF table prior to importing points with {{cmd|v.in.ascii}}:&lt;br /&gt;
  # Manually connect the DBF table&lt;br /&gt;
  db.connect driver=dbf database='$GISDBASE/$LOCATION_NAME/$MAPSET/dbf&lt;br /&gt;
  &lt;br /&gt;
  # Display the connection (has to be a separate command and run or the connection does not work)&lt;br /&gt;
  db.connect -p&lt;br /&gt;
&lt;br /&gt;
== Sample LIDAR data ==&lt;br /&gt;
&lt;br /&gt;
=== Widely used in GRASS tutorials ===&lt;br /&gt;
&lt;br /&gt;
* [http://www.grassbook.org/data_menu2nd.php Jockey's Ridge, NC, LIDAR dataset]&lt;br /&gt;
* [http://www.grassbook.org/data_menu3rd.php North Carolina OSGeo Edu data set] (includes multi-return LIDAR data)&lt;br /&gt;
&lt;br /&gt;
=== Other ===&lt;br /&gt;
&lt;br /&gt;
* United States Antarctic Resource Center: LIDAR High-resolution DEM Final DATA Downloads&amp;lt;BR&amp;gt;http://usarc.usgs.gov/lidar_dload.shtml&lt;br /&gt;
&lt;br /&gt;
* LIDAR ALSM Research, Arizona State University Ative Tectonics, Research Group&amp;lt;BR&amp;gt;  http://lidar.asu.edu/research.html and http://www.geongrid.org/science/lidar.html&lt;br /&gt;
&lt;br /&gt;
* USGS Center for LIDAR Information Coordination and Knowledge (aka CLICK) - USGS LiDAR point cloud distribution site&amp;lt;BR&amp;gt; http://lidar.cr.usgs.gov&lt;br /&gt;
&lt;br /&gt;
* Washington State Geospatial Data Archive, Mount Saint Helens - Lidar Data &amp;lt;BR&amp;gt;https://wagda.lib.washington.edu/data/type/elevation/lidar/st_helens/&lt;br /&gt;
&lt;br /&gt;
* Puget Sound Lidar Consortium, public-domain high-resolution topography for western Washington&amp;lt;BR&amp;gt;http://pugetsoundlidar.ess.washington.edu/index.htm&lt;br /&gt;
&lt;br /&gt;
* NOAA Topographic Change Mapping LIDAR Data Retrieval Tool (LDART) NOAA Coastal Services Center&amp;lt;BR&amp;gt;http://maps.csc.noaa.gov/TCM/&lt;br /&gt;
&lt;br /&gt;
* Landmap, LIDAR Data from the Environment Agency &amp;lt;BR&amp;gt;http://www.landmap.ac.uk/lidar/lidar.html&lt;br /&gt;
&lt;br /&gt;
* Northern California LIDAR data &amp;lt;BR&amp;gt;http://quake.usgs.gov/research/geology/lidar/  and http://core2.gsfc.nasa.gov/lidar/terrapoint/&lt;br /&gt;
&lt;br /&gt;
* IDAHO GEOSPATIAL , Bare Earth LIDAR DEM Download - UTM &amp;lt;BR&amp;gt;http://inside.uidaho.edu/geodata/LiDAR/LiDARBareEarthDEM_DownloadUTM.htm&lt;br /&gt;
&lt;br /&gt;
* EarthScope Spatial Data Explorer - A java application for querying, browsing, and acquiring data from the EarthScope Spatial Data Repository. Currently includes a number of LiDAR datasets. &amp;lt;BR&amp;gt;http://www.earthscope.org/data/lidar.php&lt;br /&gt;
&lt;br /&gt;
* LIDAR Galley &amp;lt;BR&amp;gt;https://peoiewswebinfo.monmouth.army.mil/JPSD/LIDAR_Gallery.htm&lt;br /&gt;
&lt;br /&gt;
* South Tyrol - Download of DTMs (Homepage in German or Italian) &amp;lt;BR&amp;gt; http://www.provinz.bz.it/raumordnung/grundkarten/utm/default_d.htm&lt;br /&gt;
&lt;br /&gt;
== Links ==&lt;br /&gt;
&lt;br /&gt;
* [http://liblas.org/ libLAS] - LAS 1.0/1.1 ASPRS LiDAR data translation toolset&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>⚠️John Tate</name></author>
	</entry>
	<entry>
		<id>https://grasswiki.osgeo.org/w/index.php?title=LIDAR&amp;diff=9861</id>
		<title>LIDAR</title>
		<link rel="alternate" type="text/html" href="https://grasswiki.osgeo.org/w/index.php?title=LIDAR&amp;diff=9861"/>
		<updated>2009-11-05T15:44:37Z</updated>

		<summary type="html">&lt;p&gt;⚠️John Tate: /* DEM/DSM separation the more complex way */  added NB about spline steps = 1m&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;h1&amp;gt; LIDAR and Multi-beam Swath bathymetry data &amp;lt;/h1&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Modules ==&lt;br /&gt;
&lt;br /&gt;
=== Import ===&lt;br /&gt;
&lt;br /&gt;
* {{cmd|r.in.xyz}} - Create a raster map from an assemblage of many coordinates using univariate statistics. ([http://hamish.bowman.googlepages.com/grassfiles#xyz example])&lt;br /&gt;
&lt;br /&gt;
* {{cmd|v.in.ascii}} - Import data from an ASCII file to GRASS vector format.&lt;br /&gt;
: ''Due to memory overhead vector point imports will be limited to a few million data points unless topology and database creation is skipped with the '''-bt''' flags''. It may also be useful to clip the import file to only accept points falling within the current region by using the '''-r''' flag. See {{cmd|g.region}} for details on specifying the region bounds.&lt;br /&gt;
&lt;br /&gt;
=== Analysis ===&lt;br /&gt;
&lt;br /&gt;
* {{cmd|v.outlier}} - Removes outliers from vector point data.&lt;br /&gt;
&lt;br /&gt;
* {{cmd|v.lidar.edgedetection}} - Detect the object's edges from a LIDAR data set.&lt;br /&gt;
&lt;br /&gt;
* {{cmd|v.lidar.growing}} - Building contour determination and Region Growing algorithm for determining the building inside.&lt;br /&gt;
&lt;br /&gt;
* {{cmd|v.lidar.correction}} - Correction of the v.lidar.growing output. It is the last of the three algorithms for LIDAR filtering.&lt;br /&gt;
&lt;br /&gt;
=== Surface generation ===&lt;br /&gt;
&lt;br /&gt;
* {{cmd|v.surf.rst}} - Spatial approximation and topographic analysis using regularized spline with tension.&lt;br /&gt;
&lt;br /&gt;
* {{cmd|v.surf.idw}} - Surface interpolation from vector point data by Inverse Distance Squared Weighting.&lt;br /&gt;
&lt;br /&gt;
* {{cmd|v.surf.bspline}} - Surface interpolation from vector point data by bicubic or bilineal interpolation with Tykhonov regularization.&lt;br /&gt;
&lt;br /&gt;
* {{cmd|r.fillnulls}} - Fills no-data areas in raster maps using v.surf.rst splines interpolation.&lt;br /&gt;
&lt;br /&gt;
== Swath Bathymetry Tools ==&lt;br /&gt;
&lt;br /&gt;
''see also the [[Marine_Science#Multibeam_sonar_processing]] wiki page''&lt;br /&gt;
&lt;br /&gt;
* The [http://david.p.finlayson.googlepages.com/swathwidth v.swathwidith] module by David Finlayson for planning surveys. (development page)&lt;br /&gt;
&lt;br /&gt;
* An example of [http://bambi.otago.ac.nz/hamish/grass/gdal/sidescan_warp.html post-processing scanned paper sidescan swaths] using thin plate spline warping with [http://www.gdal.org/ GDAL's] &amp;quot;&amp;lt;tt&amp;gt;gdalwarp -tps&amp;lt;/tt&amp;gt;&amp;quot; function. (debugging page)&lt;br /&gt;
&lt;br /&gt;
* [[Marine_Science#Import_into_GRASS|GRASS integration]] with [http://www.ldeo.columbia.edu/res/pi/MB-System/ MB-System] (GPL) software for processing Multibeam and Sidescan Sonar data. GRASS + MBsys + [[GMT]] make a nice scriptable trio.&lt;br /&gt;
&lt;br /&gt;
== LIDAR Tools ==&lt;br /&gt;
&lt;br /&gt;
*  {{cmd|r.terraflow}} - computation of flow direction, flow accumulation and other basic topographic terrain indices from massive raster digital elevation models (DEM). From the Duke University [http://terrain.cs.duke.edu/ STREAM] project.&lt;br /&gt;
&lt;br /&gt;
* [http://mpa.itc.it/markus/grass61/demos/rlake/ Flood simulation] using {{cmd|r.lake}}. Includes fancy NVIZ visualization of Trento, Italy, by Markus Neteler.&lt;br /&gt;
&lt;br /&gt;
* [http://www.cs.unc.edu/~isenburg/software/ LAStools] are a set of simple command line tools  (including source code) for converting to/from ASCII, viewing, comparing, and compressing LIDAR data.&lt;br /&gt;
&lt;br /&gt;
* [http://www.liblas.org libLAS] ASPRS LiDAR data translation tools&lt;br /&gt;
&lt;br /&gt;
* See also [[LIDAR#Analysis|LIDAR Analysis]]&lt;br /&gt;
&lt;br /&gt;
== Micro-tutorial for LAS data==&lt;br /&gt;
&lt;br /&gt;
=== Preparation ===&lt;br /&gt;
&lt;br /&gt;
==== Conversion of text files to LAS ====&lt;br /&gt;
&lt;br /&gt;
[http://www.liblas.org/ libLAS] supports the following column types:&lt;br /&gt;
   x - x coordinate&lt;br /&gt;
   y - y coordinate&lt;br /&gt;
   z - z coordinate&lt;br /&gt;
   a - scan angle&lt;br /&gt;
   i - intensity&lt;br /&gt;
   n - number of returns for given pulse (1..n)&lt;br /&gt;
   r - number of this return (1..r)&lt;br /&gt;
   c - classification&lt;br /&gt;
   u - user data (but only 1 byte)&lt;br /&gt;
   p - point source ID&lt;br /&gt;
   e - edge of flight line&lt;br /&gt;
   d - direction of scan flag&lt;br /&gt;
   t - GPS time&lt;br /&gt;
   s - skip column&lt;br /&gt;
&lt;br /&gt;
Sample text data such as:&lt;br /&gt;
   returntime,pulse,east,north,height,intensity,stripe&lt;br /&gt;
   549778.907200,1,673999.940,5099680.080,507.425,20.0,45105&lt;br /&gt;
   ...&lt;br /&gt;
&lt;br /&gt;
can be converted to LAS format like this:&lt;br /&gt;
   returntime - t&lt;br /&gt;
   pulse - r&lt;br /&gt;
   east - x&lt;br /&gt;
   north - y&lt;br /&gt;
   height - z&lt;br /&gt;
   intensity - i&lt;br /&gt;
   stripe - s&lt;br /&gt;
&lt;br /&gt;
First parse (sanity check):&lt;br /&gt;
   txt2las -parse trxyzis data.asc&lt;br /&gt;
&lt;br /&gt;
Then convert:&lt;br /&gt;
   txt2las -parse trxyzis -i data.asc -o data.las &lt;br /&gt;
&lt;br /&gt;
While you may not need to do this conversion for GRASS import, the resulting files are way smaller than the uncompressed text files; additionally, they are in a defined format.&lt;br /&gt;
&lt;br /&gt;
=== LAS Import ===&lt;br /&gt;
&lt;br /&gt;
* Use the [http://www.liblas.org libLAS] utilities to import LAS data into GRASS. &lt;br /&gt;
* Data stored in text files can generally be imported directly into GRASS.&lt;br /&gt;
&lt;br /&gt;
* The data used in the rest of this micro-tutorial can be found at [http://www.appliedimagery.com/Serpent%20Mound%20Model%20LAS%20Data.las appliedimagery.com].&lt;br /&gt;
&lt;br /&gt;
==== Import LAS as raster DEM ====&lt;br /&gt;
&lt;br /&gt;
Check bounds and SRS:&lt;br /&gt;
 $ lasinfo &amp;quot;Serpent_Mound_Model_LAS_Data.las&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
  [...]&lt;br /&gt;
  Min X Y Z                  289020.900000 4320942.610000 166.780000&lt;br /&gt;
  Max X Y Z                  290106.020000 4323641.570000 215.480000&lt;br /&gt;
 Spatial Reference           +proj=utm +zone=17 +ellps=WGS84 +units=m &lt;br /&gt;
&lt;br /&gt;
After creating a suitable UTM zone 17 location (EPSG:32617) &lt;br /&gt;
set the region according to the information from lasinfo at 1m resolution, rounding grid outwards to align to whole meters:&lt;br /&gt;
 GRASS&amp;gt; {{cmd|g.region}} n=4323641.57 s=4320942.61 w=289020.90 e=290106.02 res=1 -ap&lt;br /&gt;
&lt;br /&gt;
Finally, import with {{cmd|r.in.xyz}} with data piped directly from the &amp;lt;tt&amp;gt;las2txt&amp;lt;/tt&amp;gt; program and set a nice equalized color table:&lt;br /&gt;
 BASEMAP=&amp;quot;Serpent_Mound_Model_LAS&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 las2txt --stdout &amp;quot;${BASEMAP}_Data.las&amp;quot; | \&lt;br /&gt;
    r.in.xyz in=- out=${BASEMAP}_Data fs=space method=mean&lt;br /&gt;
 &lt;br /&gt;
 {{cmd|r.colors}} ${BASEMAP}_Data color=bcyr -e&lt;br /&gt;
&lt;br /&gt;
The above example uses the default z-elevation level as the 3rd term, but by using the &amp;lt;tt&amp;gt;las2txt --parse&amp;lt;/tt&amp;gt; command other fields (such as intensity) can be imported instead via &amp;quot;&amp;lt;tt&amp;gt;--parse xyi&amp;lt;/tt&amp;gt;&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
==== Import LAS as vector points ====&lt;br /&gt;
&lt;br /&gt;
Region setting (establishing the grid) is not needed for vector features so we can go directly to the import step. To deal with millions of input points {{cmd|v.in.ascii}} should be run with the options to skip creation of an attribute database and building topology as these can consume large amounts of memory. Note that vector maps without topology built are somewhat limited in their ability to be processed. Most LIDAR specific modules have been adapted to not require &lt;br /&gt;
topology. Even so, after initial cleaning steps it is often more efficient to work with huge datasets in GRASS as raster data.&lt;br /&gt;
&lt;br /&gt;
 las2txt --stdout &amp;quot;${BASEMAP}_Data.las&amp;quot; | \&lt;br /&gt;
   v.in.ascii -tbz z=3 out=&amp;quot;${BASEMAP}_pts&amp;quot; fs=space&lt;br /&gt;
&lt;br /&gt;
If topology was built, you can use {{cmd|d.vect}}'s -z flag to colorize by elevation value. Without topology you can still colorize, but you need to use color rules based on absolute elevations, not percentage of scale.&lt;br /&gt;
&amp;lt;!-- need an absolute color map gradiated across the elev range --&amp;gt;&lt;br /&gt;
 # display colorized points for data with built topology&lt;br /&gt;
 d.vect map=lidar_pts size=1 -z zcolor=elevation&lt;br /&gt;
&lt;br /&gt;
* After import as points you can then use the v.lidar tools to clean the data: {{cmd|v.lidar.correction}}, {{cmd|v.lidar.edgedetection}}, {{cmd|v.lidar.growing}}, and {{cmd|v.outlier}}.&lt;br /&gt;
&lt;br /&gt;
* Vector points can be interpolated into raster DEMs with a number of modules, including {{cmd|v.surf.rst}}, {{cmd|v.surf.bspline}}, and {{cmd|v.surf.idw}}.&lt;br /&gt;
&lt;br /&gt;
=== Clean imported raster DEM ===&lt;br /&gt;
&lt;br /&gt;
(fill holes)&lt;br /&gt;
&lt;br /&gt;
 # convert to vector points&lt;br /&gt;
 r.to.vect -z feature=point in=${BASEMAP}_Data out=${BASEMAP}_pt&lt;br /&gt;
 &lt;br /&gt;
 # interpolate using a regularized spline fit&lt;br /&gt;
 # this is very slow, but produces very high quality output&lt;br /&gt;
 v.surf.rst layer=0 in=${BASEMAP}_pt elev=${BASEMAP}.rst&lt;br /&gt;
 &lt;br /&gt;
 # create 5m buffer area around original data points&lt;br /&gt;
 r.buffer in=${BASEMAP}_Data out=${BASEMAP}.5m_buff dist=5&lt;br /&gt;
 &lt;br /&gt;
 # crop interpolated DEM to only include areas nearby actual data&lt;br /&gt;
 r.mapcalc &amp;quot;${BASEMAP}.filled = \&lt;br /&gt;
    if( isnull(${BASEMAP}.5m_buff), null(), ${BASEMAP}.rst)&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 # set colors to something nice&lt;br /&gt;
 r.colors ${BASEMAP}.filled color=bcyr -e&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Depending on your needs, {{cmd|r.fillnulls}}, {{cmd|v.surf.bspline}}, {{cmd|v.surf.idw}}, {{cmd|r.surf.idw}}, {{cmd|r.surf.idw2}}, or [[GRASS_AddOns#r.surf.nnbathy|r.surf.nnbathy]] may be faster than the {{cmd|v.surf.rst}} method.&lt;br /&gt;
&lt;br /&gt;
=== Visualize raster DEM in 3D ===&lt;br /&gt;
&lt;br /&gt;
 nviz ${BASEMAP}.filled&lt;br /&gt;
&lt;br /&gt;
* Set z-exag to 2.0&lt;br /&gt;
* In Visualize &amp;amp;rarr; Raster Surfaces set the fine (final) resolution to 1, and coarse (preview) resolution to 5.&lt;br /&gt;
* Set the height to 500.0, the perspective to 15.0, and drag the view-puck to the North-West and reasonably zoomed in.&lt;br /&gt;
: You should now be able to see the serpent:&lt;br /&gt;
&lt;br /&gt;
[[Image:LAS_serpent_nviz.jpg|thumb|center|400px|The Great Serpent Mound, Adams County, Ohio, USA]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
It is possible to show vector points in 3D, but millions of them may make the program run slow. Topology is required ({{cmd|v.build}}). Tick the &amp;quot;3D&amp;quot; box in the Visualize &amp;amp;rarr; Vector points dialog.&lt;br /&gt;
&lt;br /&gt;
=== LAS Export ===&lt;br /&gt;
&lt;br /&gt;
==== Export to LAS ====&lt;br /&gt;
&lt;br /&gt;
This is the reverse of the import step, but using {{cmd|v.out.ascii}} or {{cmd|r.out.xyz}} with ''txt2las''.&lt;br /&gt;
Because the v.out.ascii module exports category number which we are not interested in, we cut it away with the UNIX ''cut'' utility.&lt;br /&gt;
&lt;br /&gt;
 v.out.ascii ${BASEMAP}_pts fs=space | cut -f1-3 -d' ' \&lt;br /&gt;
     &amp;gt; ${BASEMAP}_export.txt&lt;br /&gt;
 &lt;br /&gt;
 txt2las --parse xyz -i ${BASEMAP}_export.txt&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Micro-tutorial for LIDAR data analysis ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Simple analysis of single return data ===&lt;br /&gt;
&lt;br /&gt;
Data source: North Carolina sample data set (Lidar data from 2001, near Raleigh, North Carolina). Download from&lt;br /&gt;
   http://www.grassbook.org/ncexternal/&lt;br /&gt;
   -&amp;gt; File: BE3720079200WC20020829m.txt 3.6M (lidar bare earth points [spm])&lt;br /&gt;
&lt;br /&gt;
Scan input file for spatial extent. The -g flag shows the result in a convenient copy-paste format for {{cmd|g.region}}:&lt;br /&gt;
   r.in.xyz BE3720079200WC20020829m.txt out=dummy -s -g&lt;br /&gt;
&lt;br /&gt;
We use this output to set region, predefine 2m raster cells, and polish the odd coordinates with -a:&lt;br /&gt;
   g.region n=222504.439000 s=219456.442000 e=640081.274000 w=637033.274000 res=2 -a -p&lt;br /&gt;
&lt;br /&gt;
==== QUESTION 1: Are these Lidar data sufficiently dense? ====&lt;br /&gt;
&lt;br /&gt;
We compute a raster map representing number of points per cell&lt;br /&gt;
   r.in.xyz BE3720079200WC20020829m.txt out=lid_792_binn2m method=n&lt;br /&gt;
&lt;br /&gt;
Look at the resulting raster map:&lt;br /&gt;
   d.mon x0&lt;br /&gt;
   d.font Vera&lt;br /&gt;
   d.rast.leg lid_792_binn2m&lt;br /&gt;
&lt;br /&gt;
Report point distribution in percent:&lt;br /&gt;
   r.report lid_792_binn2m unit=p&lt;br /&gt;
&lt;br /&gt;
Reduce the resolution to 6m to get at least one point per cell:&lt;br /&gt;
   g.region res=6 -a -p&lt;br /&gt;
   r.in.xyz BE3720079200WC20020829m.txt out=lid_792_binn6m method=n&lt;br /&gt;
   d.rast.leg lid_792_binn6m&lt;br /&gt;
   # ... a few holes remain but that's probably acceptable.&lt;br /&gt;
&lt;br /&gt;
Compute raster maps representing mean elevation for each cell:&lt;br /&gt;
   r.in.xyz BE3720079200WC20020829m.txt out=lid_792_binmean6m  \&lt;br /&gt;
            meth=mean&lt;br /&gt;
   d.rast.leg lid_792_binmean6m&lt;br /&gt;
&lt;br /&gt;
Compute range and variation:&lt;br /&gt;
   r.in.xyz BE3720079200WC20020829m.txt out=lid_792_binrange6m \&lt;br /&gt;
            meth=range&lt;br /&gt;
   d.rast.leg lid_792_binrange6m&lt;br /&gt;
   r.in.xyz BE3720079200WC20020829m.txt out=lid_792_binvar6m   \&lt;br /&gt;
            meth=coeff_var&lt;br /&gt;
   d.rast.leg lid_792_binvar6m&lt;br /&gt;
&lt;br /&gt;
Overlay other GIS maps to map of mean elevation:&lt;br /&gt;
   d.rast.leg lid_792_binmean6m&lt;br /&gt;
   d.vect streets_wake&lt;br /&gt;
   d.vect lakes type=boundary&lt;br /&gt;
   d.vect streams&lt;br /&gt;
&lt;br /&gt;
Now we continue to work in a zoomed spatial subset of the area.&lt;br /&gt;
&lt;br /&gt;
We import only points in the rural area without building topology and using z-coordinate for elevation:&lt;br /&gt;
   g.region rural_1m -p&lt;br /&gt;
   v.in.ascii -ztbr BE3720079200WC20020829m.txt \&lt;br /&gt;
              out=elev_lidrural_bepts z=3&lt;br /&gt;
&lt;br /&gt;
Clear monitor show black-white orthophoto:&lt;br /&gt;
   d.erase -f&lt;br /&gt;
   d.rast ortho_2001_t792_1m&lt;br /&gt;
&lt;br /&gt;
We now use already prepared Lidar vector point maps:&lt;br /&gt;
* elev_lid792_bepts:   Rural area (in tile 792), bare earth lidar point cloud&lt;br /&gt;
* elev_lidrural_mrpts: Rural area multiple return lidar point cloud&lt;br /&gt;
&lt;br /&gt;
Look at ground data:&lt;br /&gt;
d.vect elev_lidrural_bepts siz=2 col=red&lt;br /&gt;
&lt;br /&gt;
Look at &amp;quot;surface&amp;quot; data:&lt;br /&gt;
d.vect elev_lidrural_mrpts siz=1 col=green&lt;br /&gt;
&lt;br /&gt;
Visualize 3D Lidar multi-return points:&lt;br /&gt;
nviz elev_lid792_1m point=elev_lidrural_mrpts&lt;br /&gt;
 # Visualize -&amp;gt; Vector Points -&amp;gt; 3D points&lt;br /&gt;
 #                            -&amp;gt; Icon size 2.25&lt;br /&gt;
 #  --&amp;gt; GRASS book p. 253, fig. 3.15 (see also screenshot [http://www.grassbook.org/about_menu3rd.php here])&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== DEM/DSM separation the simple way by selection of Lidar returns ====&lt;br /&gt;
&lt;br /&gt;
Find out where we have multiple returns:&lt;br /&gt;
   d.rast ortho_2001_t792_1m&lt;br /&gt;
   d.vect elev_lidrural_mrpts where=&amp;quot;return=1&amp;quot; col=red siz=2&lt;br /&gt;
   d.vect elev_lidrural_mrpts where=&amp;quot;return=2&amp;quot; col=green siz=3&lt;br /&gt;
   d.vect elev_lidrural_mrpts where=&amp;quot;return=3&amp;quot; col=blue&lt;br /&gt;
   d.vect elev_lidrural_mrpts where=&amp;quot;return=4&amp;quot; col=yellow&lt;br /&gt;
&lt;br /&gt;
DTM: extract last return(s):&lt;br /&gt;
   v.extract elev_lidrural_mrpts out=elev_lidrural_mrpts_first where=&amp;quot;Return &amp;lt; 2&amp;quot;&lt;br /&gt;
   nviz elev_lid792_1m point=elev_lidrural_mrpts_first&lt;br /&gt;
&lt;br /&gt;
Interpolate to map and look at it:&lt;br /&gt;
   v.surf.rst elev_lidrural_mrpts_first layer=0 elev=elev_lidrural_mrpts_DTM&lt;br /&gt;
   nviz elev_lidrural_mrpts_DTM col=ortho_2001_t792_1m&lt;br /&gt;
&lt;br /&gt;
DSM: extract first return(s):&lt;br /&gt;
   v.extract elev_lidrural_mrpts out=elev_lidrural_mrpts_last where=&amp;quot;Return &amp;gt; 2&amp;quot;&lt;br /&gt;
   nviz elev_lid792_1m point=elev_lidrural_mrpts_last&lt;br /&gt;
&lt;br /&gt;
Interpolate to map and look at it:&lt;br /&gt;
   v.surf.rst elev_lidrural_mrpts_first layer=0 elev=elev_lidrural_mrpts_DSM&lt;br /&gt;
   nviz elev_lidrural_mrpts_DSM col=ortho_2001_t792_1m&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== DEM/DSM separation the more complex way ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;''TODO: verify order of first and last returns in below text''&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
General procedure:&lt;br /&gt;
* Lidar point clouds (first and last return) are imported with {{cmd|v.in.ascii}} (-b flag to not build the topology).&lt;br /&gt;
* Outlier detection is done with {{cmd|v.outlier}} on both first and last return data (NB currently a selection of &amp;lt;/=4 for soe/son in {{cmd|v.outlier}} results in an error message).&lt;br /&gt;
* Then, with {{cmd|v.lidar.edgedetection}}, edges are detected from last return data.&lt;br /&gt;
* The building are generated by {{cmd|v.lidar.growing}} from detected edges.&lt;br /&gt;
* The resulting data are post-processed with {{cmd|v.lidar.correction}}.&lt;br /&gt;
* Finally, the DTM and DSM are generated with {{cmd|v.surf.bspline}} (DTM: uses the 'v.lidar.correction' output; DSM: uses last return output from outlier detection).&lt;br /&gt;
* NB for {{cmd|v.outlier}}, {{cmd|v.lidar.edgedetection}} and {{cmd|v.surf.bspline}}, one spline steps equates to 1m. It is recommend as a starting point that the choice of spline step is roughly 3 or 4 times the planimetric resolution (potential grid resolution) of your data. Experiment from there to obtain better results.&lt;br /&gt;
&lt;br /&gt;
  export GRASS_OVERWRITE=1&lt;br /&gt;
  v.extract elev_lidrural_mrpts out=elev_lidfirst_pts \&lt;br /&gt;
            where=&amp;quot;return = 1&amp;quot;&lt;br /&gt;
  v.extract elev_lidrural_mrpts out=elev_lidlast_pts  \&lt;br /&gt;
            where=&amp;quot;return &amp;gt;= 2&amp;quot;&lt;br /&gt;
  d.vect elev_lidfirst_pts col=red&lt;br /&gt;
  d.vect elev_lidlast_pts col=green&lt;br /&gt;
&lt;br /&gt;
Outlier detection and separation into two maps&lt;br /&gt;
  # 1st return&lt;br /&gt;
  v.outlier elev_lidfirst_pts output=elev_lidfirst_clean \&lt;br /&gt;
            outlier=elev_lidfirst_outl&lt;br /&gt;
  d.erase&lt;br /&gt;
  d.vect elev_lidfirst_clean siz=2&lt;br /&gt;
  d.vect elev_lidfirst_outl col=red&lt;br /&gt;
&lt;br /&gt;
2nd return&lt;br /&gt;
  v.outlier elev_lidlast_pts output=elev_lidlast_clean \&lt;br /&gt;
            outlier=elev_lidlast_outl&lt;br /&gt;
  d.erase&lt;br /&gt;
  d.vect elev_lidlast_clean siz=2&lt;br /&gt;
  d.vect elev_lidlast_outl col=red&lt;br /&gt;
  # -&amp;gt; no outliers visible&lt;br /&gt;
&lt;br /&gt;
Run an edge detection on cleaned last return:&lt;br /&gt;
  v.lidar.edgedetection elev_lidlast_clean \&lt;br /&gt;
                        out=elev_lidlast_edges&lt;br /&gt;
&lt;br /&gt;
Buildings/vegetation are generated from detected edges (bug: you may need to specify the mapset):&lt;br /&gt;
  v.lidar.growing elev_lidlast_edges@lidar out=elev_lidlast_grow \&lt;br /&gt;
                  first=elev_lidfirst_clean&lt;br /&gt;
&lt;br /&gt;
Compare:&lt;br /&gt;
  d.vect elev_lidlast_pts col=blue&lt;br /&gt;
  d.vect elev_lidlast_grow col=green&lt;br /&gt;
&lt;br /&gt;
Correction (this is applied twice):&lt;br /&gt;
  v.lidar.correction elev_lidlast_grow out=elev_lidlast_corr1 \&lt;br /&gt;
                     terrain=elev_lidlast_terr1&lt;br /&gt;
  v.lidar.correction elev_lidlast_corr1 out=elev_lid_dsm \&lt;br /&gt;
                     terrain=elev_lid_dtm&lt;br /&gt;
&lt;br /&gt;
DEM and DSM are generated:&lt;br /&gt;
  # Estimation of lambda_i parameter with cross validation (watch for RMS!)&lt;br /&gt;
  v.surf.bspline -c elev_lid_dsm sie=100 sin=100&lt;br /&gt;
  v.surf.bspline -c elev_lid_dtm sie=100 sin=100&lt;br /&gt;
  &lt;br /&gt;
  # From the cross-validation, we select lambda with minimal RMS error:&lt;br /&gt;
  # generate raster surfaces at 1m resolution&lt;br /&gt;
  v.surf.bspline elev_lid_dsm raster=lidar_dsm lambda=0.1&lt;br /&gt;
  v.surf.bspline elev_lid_dtm raster=lidar_dtm lambda=0.0001&lt;br /&gt;
  &lt;br /&gt;
  d.rast lidar_dsm&lt;br /&gt;
  d.rast lidar_dtm&lt;br /&gt;
  &lt;br /&gt;
  nviz lidar_dsm,lidar_dtm \&lt;br /&gt;
       col=ortho_2001_t792_1m,ortho_2001_t792_1m&lt;br /&gt;
&lt;br /&gt;
...with the position slider you can visually separate DSM and DEM, increase z slider (Visualize -&amp;gt; Raster Surface -&amp;gt; Position).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Windows users (6.4.x only?):'''&lt;br /&gt;
* When using the DBF driver (default) it is necessary to manually create the DBF table prior to importing points with {{cmd|v.in.ascii}}:&lt;br /&gt;
  # Manually connect the DBF table&lt;br /&gt;
  db.connect driver=dbf database='$GISDBASE/$LOCATION_NAME/$MAPSET/dbf&lt;br /&gt;
  &lt;br /&gt;
  # Display the connection (has to be a separate command and run or the connection does not work)&lt;br /&gt;
  db.connect -p&lt;br /&gt;
&lt;br /&gt;
== Sample LIDAR data ==&lt;br /&gt;
&lt;br /&gt;
=== Widely used in GRASS tutorials ===&lt;br /&gt;
&lt;br /&gt;
* [http://www.grassbook.org/data_menu2nd.php Jockey's Ridge, NC, LIDAR dataset]&lt;br /&gt;
* [http://www.grassbook.org/data_menu3rd.php North Carolina OSGeo Edu data set] (includes multi-return LIDAR data)&lt;br /&gt;
&lt;br /&gt;
=== Other ===&lt;br /&gt;
&lt;br /&gt;
* United States Antarctic Resource Center: LIDAR High-resolution DEM Final DATA Downloads&amp;lt;BR&amp;gt;http://usarc.usgs.gov/lidar_dload.shtml&lt;br /&gt;
&lt;br /&gt;
* LIDAR ALSM Research, Arizona State University Ative Tectonics, Research Group&amp;lt;BR&amp;gt;  http://lidar.asu.edu/research.html and http://www.geongrid.org/science/lidar.html&lt;br /&gt;
&lt;br /&gt;
* USGS Center for LIDAR Information Coordination and Knowledge (aka CLICK) - USGS LiDAR point cloud distribution site&amp;lt;BR&amp;gt; http://lidar.cr.usgs.gov&lt;br /&gt;
&lt;br /&gt;
* Washington State Geospatial Data Archive, Mount Saint Helens - Lidar Data &amp;lt;BR&amp;gt;https://wagda.lib.washington.edu/data/type/elevation/lidar/st_helens/&lt;br /&gt;
&lt;br /&gt;
* Puget Sound Lidar Consortium, public-domain high-resolution topography for western Washington&amp;lt;BR&amp;gt;http://pugetsoundlidar.ess.washington.edu/index.htm&lt;br /&gt;
&lt;br /&gt;
* NOAA Topographic Change Mapping LIDAR Data Retrieval Tool (LDART) NOAA Coastal Services Center&amp;lt;BR&amp;gt;http://maps.csc.noaa.gov/TCM/&lt;br /&gt;
&lt;br /&gt;
* Landmap, LIDAR Data from the Environment Agency &amp;lt;BR&amp;gt;http://www.landmap.ac.uk/lidar/lidar.html&lt;br /&gt;
&lt;br /&gt;
* Northern California LIDAR data &amp;lt;BR&amp;gt;http://quake.usgs.gov/research/geology/lidar/  and http://core2.gsfc.nasa.gov/lidar/terrapoint/&lt;br /&gt;
&lt;br /&gt;
* IDAHO GEOSPATIAL , Bare Earth LIDAR DEM Download - UTM &amp;lt;BR&amp;gt;http://inside.uidaho.edu/geodata/LiDAR/LiDARBareEarthDEM_DownloadUTM.htm&lt;br /&gt;
&lt;br /&gt;
* EarthScope Spatial Data Explorer - A java application for querying, browsing, and acquiring data from the EarthScope Spatial Data Repository. Currently includes a number of LiDAR datasets. &amp;lt;BR&amp;gt;http://www.earthscope.org/data/lidar.php&lt;br /&gt;
&lt;br /&gt;
* LIDAR Galley &amp;lt;BR&amp;gt;https://peoiewswebinfo.monmouth.army.mil/JPSD/LIDAR_Gallery.htm&lt;br /&gt;
&lt;br /&gt;
* South Tyrol - Download of DTMs (Homepage in German or Italian) &amp;lt;BR&amp;gt; http://www.provinz.bz.it/raumordnung/grundkarten/utm/default_d.htm&lt;br /&gt;
&lt;br /&gt;
== Links ==&lt;br /&gt;
&lt;br /&gt;
* [http://liblas.org/ libLAS] - LAS 1.0/1.1 ASPRS LiDAR data translation toolset&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>⚠️John Tate</name></author>
	</entry>
	<entry>
		<id>https://grasswiki.osgeo.org/w/index.php?title=LIDAR&amp;diff=9860</id>
		<title>LIDAR</title>
		<link rel="alternate" type="text/html" href="https://grasswiki.osgeo.org/w/index.php?title=LIDAR&amp;diff=9860"/>
		<updated>2009-11-05T15:36:42Z</updated>

		<summary type="html">&lt;p&gt;⚠️John Tate: /* DEM/DSM separation the more complex way */ added windows user points at bottom of section.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;h1&amp;gt; LIDAR and Multi-beam Swath bathymetry data &amp;lt;/h1&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Modules ==&lt;br /&gt;
&lt;br /&gt;
=== Import ===&lt;br /&gt;
&lt;br /&gt;
* {{cmd|r.in.xyz}} - Create a raster map from an assemblage of many coordinates using univariate statistics. ([http://hamish.bowman.googlepages.com/grassfiles#xyz example])&lt;br /&gt;
&lt;br /&gt;
* {{cmd|v.in.ascii}} - Import data from an ASCII file to GRASS vector format.&lt;br /&gt;
: ''Due to memory overhead vector point imports will be limited to a few million data points unless topology and database creation is skipped with the '''-bt''' flags''. It may also be useful to clip the import file to only accept points falling within the current region by using the '''-r''' flag. See {{cmd|g.region}} for details on specifying the region bounds.&lt;br /&gt;
&lt;br /&gt;
=== Analysis ===&lt;br /&gt;
&lt;br /&gt;
* {{cmd|v.outlier}} - Removes outliers from vector point data.&lt;br /&gt;
&lt;br /&gt;
* {{cmd|v.lidar.edgedetection}} - Detect the object's edges from a LIDAR data set.&lt;br /&gt;
&lt;br /&gt;
* {{cmd|v.lidar.growing}} - Building contour determination and Region Growing algorithm for determining the building inside.&lt;br /&gt;
&lt;br /&gt;
* {{cmd|v.lidar.correction}} - Correction of the v.lidar.growing output. It is the last of the three algorithms for LIDAR filtering.&lt;br /&gt;
&lt;br /&gt;
=== Surface generation ===&lt;br /&gt;
&lt;br /&gt;
* {{cmd|v.surf.rst}} - Spatial approximation and topographic analysis using regularized spline with tension.&lt;br /&gt;
&lt;br /&gt;
* {{cmd|v.surf.idw}} - Surface interpolation from vector point data by Inverse Distance Squared Weighting.&lt;br /&gt;
&lt;br /&gt;
* {{cmd|v.surf.bspline}} - Surface interpolation from vector point data by bicubic or bilineal interpolation with Tykhonov regularization.&lt;br /&gt;
&lt;br /&gt;
* {{cmd|r.fillnulls}} - Fills no-data areas in raster maps using v.surf.rst splines interpolation.&lt;br /&gt;
&lt;br /&gt;
== Swath Bathymetry Tools ==&lt;br /&gt;
&lt;br /&gt;
''see also the [[Marine_Science#Multibeam_sonar_processing]] wiki page''&lt;br /&gt;
&lt;br /&gt;
* The [http://david.p.finlayson.googlepages.com/swathwidth v.swathwidith] module by David Finlayson for planning surveys. (development page)&lt;br /&gt;
&lt;br /&gt;
* An example of [http://bambi.otago.ac.nz/hamish/grass/gdal/sidescan_warp.html post-processing scanned paper sidescan swaths] using thin plate spline warping with [http://www.gdal.org/ GDAL's] &amp;quot;&amp;lt;tt&amp;gt;gdalwarp -tps&amp;lt;/tt&amp;gt;&amp;quot; function. (debugging page)&lt;br /&gt;
&lt;br /&gt;
* [[Marine_Science#Import_into_GRASS|GRASS integration]] with [http://www.ldeo.columbia.edu/res/pi/MB-System/ MB-System] (GPL) software for processing Multibeam and Sidescan Sonar data. GRASS + MBsys + [[GMT]] make a nice scriptable trio.&lt;br /&gt;
&lt;br /&gt;
== LIDAR Tools ==&lt;br /&gt;
&lt;br /&gt;
*  {{cmd|r.terraflow}} - computation of flow direction, flow accumulation and other basic topographic terrain indices from massive raster digital elevation models (DEM). From the Duke University [http://terrain.cs.duke.edu/ STREAM] project.&lt;br /&gt;
&lt;br /&gt;
* [http://mpa.itc.it/markus/grass61/demos/rlake/ Flood simulation] using {{cmd|r.lake}}. Includes fancy NVIZ visualization of Trento, Italy, by Markus Neteler.&lt;br /&gt;
&lt;br /&gt;
* [http://www.cs.unc.edu/~isenburg/software/ LAStools] are a set of simple command line tools  (including source code) for converting to/from ASCII, viewing, comparing, and compressing LIDAR data.&lt;br /&gt;
&lt;br /&gt;
* [http://www.liblas.org libLAS] ASPRS LiDAR data translation tools&lt;br /&gt;
&lt;br /&gt;
* See also [[LIDAR#Analysis|LIDAR Analysis]]&lt;br /&gt;
&lt;br /&gt;
== Micro-tutorial for LAS data==&lt;br /&gt;
&lt;br /&gt;
=== Preparation ===&lt;br /&gt;
&lt;br /&gt;
==== Conversion of text files to LAS ====&lt;br /&gt;
&lt;br /&gt;
[http://www.liblas.org/ libLAS] supports the following column types:&lt;br /&gt;
   x - x coordinate&lt;br /&gt;
   y - y coordinate&lt;br /&gt;
   z - z coordinate&lt;br /&gt;
   a - scan angle&lt;br /&gt;
   i - intensity&lt;br /&gt;
   n - number of returns for given pulse (1..n)&lt;br /&gt;
   r - number of this return (1..r)&lt;br /&gt;
   c - classification&lt;br /&gt;
   u - user data (but only 1 byte)&lt;br /&gt;
   p - point source ID&lt;br /&gt;
   e - edge of flight line&lt;br /&gt;
   d - direction of scan flag&lt;br /&gt;
   t - GPS time&lt;br /&gt;
   s - skip column&lt;br /&gt;
&lt;br /&gt;
Sample text data such as:&lt;br /&gt;
   returntime,pulse,east,north,height,intensity,stripe&lt;br /&gt;
   549778.907200,1,673999.940,5099680.080,507.425,20.0,45105&lt;br /&gt;
   ...&lt;br /&gt;
&lt;br /&gt;
can be converted to LAS format like this:&lt;br /&gt;
   returntime - t&lt;br /&gt;
   pulse - r&lt;br /&gt;
   east - x&lt;br /&gt;
   north - y&lt;br /&gt;
   height - z&lt;br /&gt;
   intensity - i&lt;br /&gt;
   stripe - s&lt;br /&gt;
&lt;br /&gt;
First parse (sanity check):&lt;br /&gt;
   txt2las -parse trxyzis data.asc&lt;br /&gt;
&lt;br /&gt;
Then convert:&lt;br /&gt;
   txt2las -parse trxyzis -i data.asc -o data.las &lt;br /&gt;
&lt;br /&gt;
While you may not need to do this conversion for GRASS import, the resulting files are way smaller than the uncompressed text files; additionally, they are in a defined format.&lt;br /&gt;
&lt;br /&gt;
=== LAS Import ===&lt;br /&gt;
&lt;br /&gt;
* Use the [http://www.liblas.org libLAS] utilities to import LAS data into GRASS. &lt;br /&gt;
* Data stored in text files can generally be imported directly into GRASS.&lt;br /&gt;
&lt;br /&gt;
* The data used in the rest of this micro-tutorial can be found at [http://www.appliedimagery.com/Serpent%20Mound%20Model%20LAS%20Data.las appliedimagery.com].&lt;br /&gt;
&lt;br /&gt;
==== Import LAS as raster DEM ====&lt;br /&gt;
&lt;br /&gt;
Check bounds and SRS:&lt;br /&gt;
 $ lasinfo &amp;quot;Serpent_Mound_Model_LAS_Data.las&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
  [...]&lt;br /&gt;
  Min X Y Z                  289020.900000 4320942.610000 166.780000&lt;br /&gt;
  Max X Y Z                  290106.020000 4323641.570000 215.480000&lt;br /&gt;
 Spatial Reference           +proj=utm +zone=17 +ellps=WGS84 +units=m &lt;br /&gt;
&lt;br /&gt;
After creating a suitable UTM zone 17 location (EPSG:32617) &lt;br /&gt;
set the region according to the information from lasinfo at 1m resolution, rounding grid outwards to align to whole meters:&lt;br /&gt;
 GRASS&amp;gt; {{cmd|g.region}} n=4323641.57 s=4320942.61 w=289020.90 e=290106.02 res=1 -ap&lt;br /&gt;
&lt;br /&gt;
Finally, import with {{cmd|r.in.xyz}} with data piped directly from the &amp;lt;tt&amp;gt;las2txt&amp;lt;/tt&amp;gt; program and set a nice equalized color table:&lt;br /&gt;
 BASEMAP=&amp;quot;Serpent_Mound_Model_LAS&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 las2txt --stdout &amp;quot;${BASEMAP}_Data.las&amp;quot; | \&lt;br /&gt;
    r.in.xyz in=- out=${BASEMAP}_Data fs=space method=mean&lt;br /&gt;
 &lt;br /&gt;
 {{cmd|r.colors}} ${BASEMAP}_Data color=bcyr -e&lt;br /&gt;
&lt;br /&gt;
The above example uses the default z-elevation level as the 3rd term, but by using the &amp;lt;tt&amp;gt;las2txt --parse&amp;lt;/tt&amp;gt; command other fields (such as intensity) can be imported instead via &amp;quot;&amp;lt;tt&amp;gt;--parse xyi&amp;lt;/tt&amp;gt;&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
==== Import LAS as vector points ====&lt;br /&gt;
&lt;br /&gt;
Region setting (establishing the grid) is not needed for vector features so we can go directly to the import step. To deal with millions of input points {{cmd|v.in.ascii}} should be run with the options to skip creation of an attribute database and building topology as these can consume large amounts of memory. Note that vector maps without topology built are somewhat limited in their ability to be processed. Most LIDAR specific modules have been adapted to not require &lt;br /&gt;
topology. Even so, after initial cleaning steps it is often more efficient to work with huge datasets in GRASS as raster data.&lt;br /&gt;
&lt;br /&gt;
 las2txt --stdout &amp;quot;${BASEMAP}_Data.las&amp;quot; | \&lt;br /&gt;
   v.in.ascii -tbz z=3 out=&amp;quot;${BASEMAP}_pts&amp;quot; fs=space&lt;br /&gt;
&lt;br /&gt;
If topology was built, you can use {{cmd|d.vect}}'s -z flag to colorize by elevation value. Without topology you can still colorize, but you need to use color rules based on absolute elevations, not percentage of scale.&lt;br /&gt;
&amp;lt;!-- need an absolute color map gradiated across the elev range --&amp;gt;&lt;br /&gt;
 # display colorized points for data with built topology&lt;br /&gt;
 d.vect map=lidar_pts size=1 -z zcolor=elevation&lt;br /&gt;
&lt;br /&gt;
* After import as points you can then use the v.lidar tools to clean the data: {{cmd|v.lidar.correction}}, {{cmd|v.lidar.edgedetection}}, {{cmd|v.lidar.growing}}, and {{cmd|v.outlier}}.&lt;br /&gt;
&lt;br /&gt;
* Vector points can be interpolated into raster DEMs with a number of modules, including {{cmd|v.surf.rst}}, {{cmd|v.surf.bspline}}, and {{cmd|v.surf.idw}}.&lt;br /&gt;
&lt;br /&gt;
=== Clean imported raster DEM ===&lt;br /&gt;
&lt;br /&gt;
(fill holes)&lt;br /&gt;
&lt;br /&gt;
 # convert to vector points&lt;br /&gt;
 r.to.vect -z feature=point in=${BASEMAP}_Data out=${BASEMAP}_pt&lt;br /&gt;
 &lt;br /&gt;
 # interpolate using a regularized spline fit&lt;br /&gt;
 # this is very slow, but produces very high quality output&lt;br /&gt;
 v.surf.rst layer=0 in=${BASEMAP}_pt elev=${BASEMAP}.rst&lt;br /&gt;
 &lt;br /&gt;
 # create 5m buffer area around original data points&lt;br /&gt;
 r.buffer in=${BASEMAP}_Data out=${BASEMAP}.5m_buff dist=5&lt;br /&gt;
 &lt;br /&gt;
 # crop interpolated DEM to only include areas nearby actual data&lt;br /&gt;
 r.mapcalc &amp;quot;${BASEMAP}.filled = \&lt;br /&gt;
    if( isnull(${BASEMAP}.5m_buff), null(), ${BASEMAP}.rst)&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 # set colors to something nice&lt;br /&gt;
 r.colors ${BASEMAP}.filled color=bcyr -e&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Depending on your needs, {{cmd|r.fillnulls}}, {{cmd|v.surf.bspline}}, {{cmd|v.surf.idw}}, {{cmd|r.surf.idw}}, {{cmd|r.surf.idw2}}, or [[GRASS_AddOns#r.surf.nnbathy|r.surf.nnbathy]] may be faster than the {{cmd|v.surf.rst}} method.&lt;br /&gt;
&lt;br /&gt;
=== Visualize raster DEM in 3D ===&lt;br /&gt;
&lt;br /&gt;
 nviz ${BASEMAP}.filled&lt;br /&gt;
&lt;br /&gt;
* Set z-exag to 2.0&lt;br /&gt;
* In Visualize &amp;amp;rarr; Raster Surfaces set the fine (final) resolution to 1, and coarse (preview) resolution to 5.&lt;br /&gt;
* Set the height to 500.0, the perspective to 15.0, and drag the view-puck to the North-West and reasonably zoomed in.&lt;br /&gt;
: You should now be able to see the serpent:&lt;br /&gt;
&lt;br /&gt;
[[Image:LAS_serpent_nviz.jpg|thumb|center|400px|The Great Serpent Mound, Adams County, Ohio, USA]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
It is possible to show vector points in 3D, but millions of them may make the program run slow. Topology is required ({{cmd|v.build}}). Tick the &amp;quot;3D&amp;quot; box in the Visualize &amp;amp;rarr; Vector points dialog.&lt;br /&gt;
&lt;br /&gt;
=== LAS Export ===&lt;br /&gt;
&lt;br /&gt;
==== Export to LAS ====&lt;br /&gt;
&lt;br /&gt;
This is the reverse of the import step, but using {{cmd|v.out.ascii}} or {{cmd|r.out.xyz}} with ''txt2las''.&lt;br /&gt;
Because the v.out.ascii module exports category number which we are not interested in, we cut it away with the UNIX ''cut'' utility.&lt;br /&gt;
&lt;br /&gt;
 v.out.ascii ${BASEMAP}_pts fs=space | cut -f1-3 -d' ' \&lt;br /&gt;
     &amp;gt; ${BASEMAP}_export.txt&lt;br /&gt;
 &lt;br /&gt;
 txt2las --parse xyz -i ${BASEMAP}_export.txt&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Micro-tutorial for LIDAR data analysis ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Simple analysis of single return data ===&lt;br /&gt;
&lt;br /&gt;
Data source: North Carolina sample data set (Lidar data from 2001, near Raleigh, North Carolina). Download from&lt;br /&gt;
   http://www.grassbook.org/ncexternal/&lt;br /&gt;
   -&amp;gt; File: BE3720079200WC20020829m.txt 3.6M (lidar bare earth points [spm])&lt;br /&gt;
&lt;br /&gt;
Scan input file for spatial extent. The -g flag shows the result in a convenient copy-paste format for {{cmd|g.region}}:&lt;br /&gt;
   r.in.xyz BE3720079200WC20020829m.txt out=dummy -s -g&lt;br /&gt;
&lt;br /&gt;
We use this output to set region, predefine 2m raster cells, and polish the odd coordinates with -a:&lt;br /&gt;
   g.region n=222504.439000 s=219456.442000 e=640081.274000 w=637033.274000 res=2 -a -p&lt;br /&gt;
&lt;br /&gt;
==== QUESTION 1: Are these Lidar data sufficiently dense? ====&lt;br /&gt;
&lt;br /&gt;
We compute a raster map representing number of points per cell&lt;br /&gt;
   r.in.xyz BE3720079200WC20020829m.txt out=lid_792_binn2m method=n&lt;br /&gt;
&lt;br /&gt;
Look at the resulting raster map:&lt;br /&gt;
   d.mon x0&lt;br /&gt;
   d.font Vera&lt;br /&gt;
   d.rast.leg lid_792_binn2m&lt;br /&gt;
&lt;br /&gt;
Report point distribution in percent:&lt;br /&gt;
   r.report lid_792_binn2m unit=p&lt;br /&gt;
&lt;br /&gt;
Reduce the resolution to 6m to get at least one point per cell:&lt;br /&gt;
   g.region res=6 -a -p&lt;br /&gt;
   r.in.xyz BE3720079200WC20020829m.txt out=lid_792_binn6m method=n&lt;br /&gt;
   d.rast.leg lid_792_binn6m&lt;br /&gt;
   # ... a few holes remain but that's probably acceptable.&lt;br /&gt;
&lt;br /&gt;
Compute raster maps representing mean elevation for each cell:&lt;br /&gt;
   r.in.xyz BE3720079200WC20020829m.txt out=lid_792_binmean6m  \&lt;br /&gt;
            meth=mean&lt;br /&gt;
   d.rast.leg lid_792_binmean6m&lt;br /&gt;
&lt;br /&gt;
Compute range and variation:&lt;br /&gt;
   r.in.xyz BE3720079200WC20020829m.txt out=lid_792_binrange6m \&lt;br /&gt;
            meth=range&lt;br /&gt;
   d.rast.leg lid_792_binrange6m&lt;br /&gt;
   r.in.xyz BE3720079200WC20020829m.txt out=lid_792_binvar6m   \&lt;br /&gt;
            meth=coeff_var&lt;br /&gt;
   d.rast.leg lid_792_binvar6m&lt;br /&gt;
&lt;br /&gt;
Overlay other GIS maps to map of mean elevation:&lt;br /&gt;
   d.rast.leg lid_792_binmean6m&lt;br /&gt;
   d.vect streets_wake&lt;br /&gt;
   d.vect lakes type=boundary&lt;br /&gt;
   d.vect streams&lt;br /&gt;
&lt;br /&gt;
Now we continue to work in a zoomed spatial subset of the area.&lt;br /&gt;
&lt;br /&gt;
We import only points in the rural area without building topology and using z-coordinate for elevation:&lt;br /&gt;
   g.region rural_1m -p&lt;br /&gt;
   v.in.ascii -ztbr BE3720079200WC20020829m.txt \&lt;br /&gt;
              out=elev_lidrural_bepts z=3&lt;br /&gt;
&lt;br /&gt;
Clear monitor show black-white orthophoto:&lt;br /&gt;
   d.erase -f&lt;br /&gt;
   d.rast ortho_2001_t792_1m&lt;br /&gt;
&lt;br /&gt;
We now use already prepared Lidar vector point maps:&lt;br /&gt;
* elev_lid792_bepts:   Rural area (in tile 792), bare earth lidar point cloud&lt;br /&gt;
* elev_lidrural_mrpts: Rural area multiple return lidar point cloud&lt;br /&gt;
&lt;br /&gt;
Look at ground data:&lt;br /&gt;
d.vect elev_lidrural_bepts siz=2 col=red&lt;br /&gt;
&lt;br /&gt;
Look at &amp;quot;surface&amp;quot; data:&lt;br /&gt;
d.vect elev_lidrural_mrpts siz=1 col=green&lt;br /&gt;
&lt;br /&gt;
Visualize 3D Lidar multi-return points:&lt;br /&gt;
nviz elev_lid792_1m point=elev_lidrural_mrpts&lt;br /&gt;
 # Visualize -&amp;gt; Vector Points -&amp;gt; 3D points&lt;br /&gt;
 #                            -&amp;gt; Icon size 2.25&lt;br /&gt;
 #  --&amp;gt; GRASS book p. 253, fig. 3.15 (see also screenshot [http://www.grassbook.org/about_menu3rd.php here])&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== DEM/DSM separation the simple way by selection of Lidar returns ====&lt;br /&gt;
&lt;br /&gt;
Find out where we have multiple returns:&lt;br /&gt;
   d.rast ortho_2001_t792_1m&lt;br /&gt;
   d.vect elev_lidrural_mrpts where=&amp;quot;return=1&amp;quot; col=red siz=2&lt;br /&gt;
   d.vect elev_lidrural_mrpts where=&amp;quot;return=2&amp;quot; col=green siz=3&lt;br /&gt;
   d.vect elev_lidrural_mrpts where=&amp;quot;return=3&amp;quot; col=blue&lt;br /&gt;
   d.vect elev_lidrural_mrpts where=&amp;quot;return=4&amp;quot; col=yellow&lt;br /&gt;
&lt;br /&gt;
DTM: extract last return(s):&lt;br /&gt;
   v.extract elev_lidrural_mrpts out=elev_lidrural_mrpts_first where=&amp;quot;Return &amp;lt; 2&amp;quot;&lt;br /&gt;
   nviz elev_lid792_1m point=elev_lidrural_mrpts_first&lt;br /&gt;
&lt;br /&gt;
Interpolate to map and look at it:&lt;br /&gt;
   v.surf.rst elev_lidrural_mrpts_first layer=0 elev=elev_lidrural_mrpts_DTM&lt;br /&gt;
   nviz elev_lidrural_mrpts_DTM col=ortho_2001_t792_1m&lt;br /&gt;
&lt;br /&gt;
DSM: extract first return(s):&lt;br /&gt;
   v.extract elev_lidrural_mrpts out=elev_lidrural_mrpts_last where=&amp;quot;Return &amp;gt; 2&amp;quot;&lt;br /&gt;
   nviz elev_lid792_1m point=elev_lidrural_mrpts_last&lt;br /&gt;
&lt;br /&gt;
Interpolate to map and look at it:&lt;br /&gt;
   v.surf.rst elev_lidrural_mrpts_first layer=0 elev=elev_lidrural_mrpts_DSM&lt;br /&gt;
   nviz elev_lidrural_mrpts_DSM col=ortho_2001_t792_1m&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== DEM/DSM separation the more complex way ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;''TODO: verify order of first and last returns in below text''&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
General procedure:&lt;br /&gt;
* Lidar point clouds (first and last return) are imported with {{cmd|v.in.ascii}} (-b flag to not build the topology).&lt;br /&gt;
* Outlier detection is done with {{cmd|v.outlier}} on both first and last return data (NB. currently a selection of &amp;lt;/=4 for soe/son in {{cmd|v.outlier}} results in an error message).&lt;br /&gt;
* Then, with {{cmd|v.lidar.edgedetection}}, edges are detected from last return data.&lt;br /&gt;
* The building are generated by {{cmd|v.lidar.growing}} from detected edges.&lt;br /&gt;
* The resulting data are post-processed with {{cmd|v.lidar.correction}}.&lt;br /&gt;
* Finally, the DTM and DSM are generated with {{cmd|v.surf.bspline}} (DTM: uses the 'v.lidar.correction' output; DSM: uses last return output from outlier detection).&lt;br /&gt;
&lt;br /&gt;
  export GRASS_OVERWRITE=1&lt;br /&gt;
  v.extract elev_lidrural_mrpts out=elev_lidfirst_pts \&lt;br /&gt;
            where=&amp;quot;return = 1&amp;quot;&lt;br /&gt;
  v.extract elev_lidrural_mrpts out=elev_lidlast_pts  \&lt;br /&gt;
            where=&amp;quot;return &amp;gt;= 2&amp;quot;&lt;br /&gt;
  d.vect elev_lidfirst_pts col=red&lt;br /&gt;
  d.vect elev_lidlast_pts col=green&lt;br /&gt;
&lt;br /&gt;
Outlier detection and separation into two maps&lt;br /&gt;
  # 1st return&lt;br /&gt;
  v.outlier elev_lidfirst_pts output=elev_lidfirst_clean \&lt;br /&gt;
            outlier=elev_lidfirst_outl&lt;br /&gt;
  d.erase&lt;br /&gt;
  d.vect elev_lidfirst_clean siz=2&lt;br /&gt;
  d.vect elev_lidfirst_outl col=red&lt;br /&gt;
&lt;br /&gt;
2nd return&lt;br /&gt;
  v.outlier elev_lidlast_pts output=elev_lidlast_clean \&lt;br /&gt;
            outlier=elev_lidlast_outl&lt;br /&gt;
  d.erase&lt;br /&gt;
  d.vect elev_lidlast_clean siz=2&lt;br /&gt;
  d.vect elev_lidlast_outl col=red&lt;br /&gt;
  # -&amp;gt; no outliers visible&lt;br /&gt;
&lt;br /&gt;
Run an edge detection on cleaned last return:&lt;br /&gt;
  v.lidar.edgedetection elev_lidlast_clean \&lt;br /&gt;
                        out=elev_lidlast_edges&lt;br /&gt;
&lt;br /&gt;
Buildings/vegetation are generated from detected edges (bug: you may need to specify the mapset):&lt;br /&gt;
  v.lidar.growing elev_lidlast_edges@lidar out=elev_lidlast_grow \&lt;br /&gt;
                  first=elev_lidfirst_clean&lt;br /&gt;
&lt;br /&gt;
Compare:&lt;br /&gt;
  d.vect elev_lidlast_pts col=blue&lt;br /&gt;
  d.vect elev_lidlast_grow col=green&lt;br /&gt;
&lt;br /&gt;
Correction (this is applied twice):&lt;br /&gt;
  v.lidar.correction elev_lidlast_grow out=elev_lidlast_corr1 \&lt;br /&gt;
                     terrain=elev_lidlast_terr1&lt;br /&gt;
  v.lidar.correction elev_lidlast_corr1 out=elev_lid_dsm \&lt;br /&gt;
                     terrain=elev_lid_dtm&lt;br /&gt;
&lt;br /&gt;
DEM and DSM are generated:&lt;br /&gt;
  # Estimation of lambda_i parameter with cross validation (watch for RMS!)&lt;br /&gt;
  v.surf.bspline -c elev_lid_dsm sie=100 sin=100&lt;br /&gt;
  v.surf.bspline -c elev_lid_dtm sie=100 sin=100&lt;br /&gt;
  &lt;br /&gt;
  # From the cross-validation, we select lambda with minimal RMS error:&lt;br /&gt;
  # generate raster surfaces at 1m resolution&lt;br /&gt;
  v.surf.bspline elev_lid_dsm raster=lidar_dsm lambda=0.1&lt;br /&gt;
  v.surf.bspline elev_lid_dtm raster=lidar_dtm lambda=0.0001&lt;br /&gt;
  &lt;br /&gt;
  d.rast lidar_dsm&lt;br /&gt;
  d.rast lidar_dtm&lt;br /&gt;
  &lt;br /&gt;
  nviz lidar_dsm,lidar_dtm \&lt;br /&gt;
       col=ortho_2001_t792_1m,ortho_2001_t792_1m&lt;br /&gt;
&lt;br /&gt;
...with the position slider you can visually separate DSM and DEM, increase z slider (Visualize -&amp;gt; Raster Surface -&amp;gt; Position).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Windows users (6.4.x only?):'''&lt;br /&gt;
* When using the DBF driver (default) it is necessary to manually create the DBF table prior to importing points with {{cmd|v.in.ascii}}:&lt;br /&gt;
  # Manually connect the DBF table&lt;br /&gt;
  db.connect driver=dbf database='$GISDBASE/$LOCATION_NAME/$MAPSET/dbf&lt;br /&gt;
  &lt;br /&gt;
  # Display the connection (has to be a separate command and run or the connection does not work)&lt;br /&gt;
  db.connect -p&lt;br /&gt;
&lt;br /&gt;
== Sample LIDAR data ==&lt;br /&gt;
&lt;br /&gt;
=== Widely used in GRASS tutorials ===&lt;br /&gt;
&lt;br /&gt;
* [http://www.grassbook.org/data_menu2nd.php Jockey's Ridge, NC, LIDAR dataset]&lt;br /&gt;
* [http://www.grassbook.org/data_menu3rd.php North Carolina OSGeo Edu data set] (includes multi-return LIDAR data)&lt;br /&gt;
&lt;br /&gt;
=== Other ===&lt;br /&gt;
&lt;br /&gt;
* United States Antarctic Resource Center: LIDAR High-resolution DEM Final DATA Downloads&amp;lt;BR&amp;gt;http://usarc.usgs.gov/lidar_dload.shtml&lt;br /&gt;
&lt;br /&gt;
* LIDAR ALSM Research, Arizona State University Ative Tectonics, Research Group&amp;lt;BR&amp;gt;  http://lidar.asu.edu/research.html and http://www.geongrid.org/science/lidar.html&lt;br /&gt;
&lt;br /&gt;
* USGS Center for LIDAR Information Coordination and Knowledge (aka CLICK) - USGS LiDAR point cloud distribution site&amp;lt;BR&amp;gt; http://lidar.cr.usgs.gov&lt;br /&gt;
&lt;br /&gt;
* Washington State Geospatial Data Archive, Mount Saint Helens - Lidar Data &amp;lt;BR&amp;gt;https://wagda.lib.washington.edu/data/type/elevation/lidar/st_helens/&lt;br /&gt;
&lt;br /&gt;
* Puget Sound Lidar Consortium, public-domain high-resolution topography for western Washington&amp;lt;BR&amp;gt;http://pugetsoundlidar.ess.washington.edu/index.htm&lt;br /&gt;
&lt;br /&gt;
* NOAA Topographic Change Mapping LIDAR Data Retrieval Tool (LDART) NOAA Coastal Services Center&amp;lt;BR&amp;gt;http://maps.csc.noaa.gov/TCM/&lt;br /&gt;
&lt;br /&gt;
* Landmap, LIDAR Data from the Environment Agency &amp;lt;BR&amp;gt;http://www.landmap.ac.uk/lidar/lidar.html&lt;br /&gt;
&lt;br /&gt;
* Northern California LIDAR data &amp;lt;BR&amp;gt;http://quake.usgs.gov/research/geology/lidar/  and http://core2.gsfc.nasa.gov/lidar/terrapoint/&lt;br /&gt;
&lt;br /&gt;
* IDAHO GEOSPATIAL , Bare Earth LIDAR DEM Download - UTM &amp;lt;BR&amp;gt;http://inside.uidaho.edu/geodata/LiDAR/LiDARBareEarthDEM_DownloadUTM.htm&lt;br /&gt;
&lt;br /&gt;
* EarthScope Spatial Data Explorer - A java application for querying, browsing, and acquiring data from the EarthScope Spatial Data Repository. Currently includes a number of LiDAR datasets. &amp;lt;BR&amp;gt;http://www.earthscope.org/data/lidar.php&lt;br /&gt;
&lt;br /&gt;
* LIDAR Galley &amp;lt;BR&amp;gt;https://peoiewswebinfo.monmouth.army.mil/JPSD/LIDAR_Gallery.htm&lt;br /&gt;
&lt;br /&gt;
* South Tyrol - Download of DTMs (Homepage in German or Italian) &amp;lt;BR&amp;gt; http://www.provinz.bz.it/raumordnung/grundkarten/utm/default_d.htm&lt;br /&gt;
&lt;br /&gt;
== Links ==&lt;br /&gt;
&lt;br /&gt;
* [http://liblas.org/ libLAS] - LAS 1.0/1.1 ASPRS LiDAR data translation toolset&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>⚠️John Tate</name></author>
	</entry>
	<entry>
		<id>https://grasswiki.osgeo.org/w/index.php?title=LIDAR&amp;diff=9859</id>
		<title>LIDAR</title>
		<link rel="alternate" type="text/html" href="https://grasswiki.osgeo.org/w/index.php?title=LIDAR&amp;diff=9859"/>
		<updated>2009-11-05T13:14:05Z</updated>

		<summary type="html">&lt;p&gt;⚠️John Tate: /* DEM/DSM separation the more complex way */  v.outlier error warning&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;h1&amp;gt; LIDAR and Multi-beam Swath bathymetry data &amp;lt;/h1&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Modules ==&lt;br /&gt;
&lt;br /&gt;
=== Import ===&lt;br /&gt;
&lt;br /&gt;
* {{cmd|r.in.xyz}} - Create a raster map from an assemblage of many coordinates using univariate statistics. ([http://hamish.bowman.googlepages.com/grassfiles#xyz example])&lt;br /&gt;
&lt;br /&gt;
* {{cmd|v.in.ascii}} - Import data from an ASCII file to GRASS vector format.&lt;br /&gt;
: ''Due to memory overhead vector point imports will be limited to a few million data points unless topology and database creation is skipped with the '''-bt''' flags''. It may also be useful to clip the import file to only accept points falling within the current region by using the '''-r''' flag. See {{cmd|g.region}} for details on specifying the region bounds.&lt;br /&gt;
&lt;br /&gt;
=== Analysis ===&lt;br /&gt;
&lt;br /&gt;
* {{cmd|v.outlier}} - Removes outliers from vector point data.&lt;br /&gt;
&lt;br /&gt;
* {{cmd|v.lidar.edgedetection}} - Detect the object's edges from a LIDAR data set.&lt;br /&gt;
&lt;br /&gt;
* {{cmd|v.lidar.growing}} - Building contour determination and Region Growing algorithm for determining the building inside.&lt;br /&gt;
&lt;br /&gt;
* {{cmd|v.lidar.correction}} - Correction of the v.lidar.growing output. It is the last of the three algorithms for LIDAR filtering.&lt;br /&gt;
&lt;br /&gt;
=== Surface generation ===&lt;br /&gt;
&lt;br /&gt;
* {{cmd|v.surf.rst}} - Spatial approximation and topographic analysis using regularized spline with tension.&lt;br /&gt;
&lt;br /&gt;
* {{cmd|v.surf.idw}} - Surface interpolation from vector point data by Inverse Distance Squared Weighting.&lt;br /&gt;
&lt;br /&gt;
* {{cmd|v.surf.bspline}} - Surface interpolation from vector point data by bicubic or bilineal interpolation with Tykhonov regularization.&lt;br /&gt;
&lt;br /&gt;
* {{cmd|r.fillnulls}} - Fills no-data areas in raster maps using v.surf.rst splines interpolation.&lt;br /&gt;
&lt;br /&gt;
== Swath Bathymetry Tools ==&lt;br /&gt;
&lt;br /&gt;
''see also the [[Marine_Science#Multibeam_sonar_processing]] wiki page''&lt;br /&gt;
&lt;br /&gt;
* The [http://david.p.finlayson.googlepages.com/swathwidth v.swathwidith] module by David Finlayson for planning surveys. (development page)&lt;br /&gt;
&lt;br /&gt;
* An example of [http://bambi.otago.ac.nz/hamish/grass/gdal/sidescan_warp.html post-processing scanned paper sidescan swaths] using thin plate spline warping with [http://www.gdal.org/ GDAL's] &amp;quot;&amp;lt;tt&amp;gt;gdalwarp -tps&amp;lt;/tt&amp;gt;&amp;quot; function. (debugging page)&lt;br /&gt;
&lt;br /&gt;
* [[Marine_Science#Import_into_GRASS|GRASS integration]] with [http://www.ldeo.columbia.edu/res/pi/MB-System/ MB-System] (GPL) software for processing Multibeam and Sidescan Sonar data. GRASS + MBsys + [[GMT]] make a nice scriptable trio.&lt;br /&gt;
&lt;br /&gt;
== LIDAR Tools ==&lt;br /&gt;
&lt;br /&gt;
*  {{cmd|r.terraflow}} - computation of flow direction, flow accumulation and other basic topographic terrain indices from massive raster digital elevation models (DEM). From the Duke University [http://terrain.cs.duke.edu/ STREAM] project.&lt;br /&gt;
&lt;br /&gt;
* [http://mpa.itc.it/markus/grass61/demos/rlake/ Flood simulation] using {{cmd|r.lake}}. Includes fancy NVIZ visualization of Trento, Italy, by Markus Neteler.&lt;br /&gt;
&lt;br /&gt;
* [http://www.cs.unc.edu/~isenburg/software/ LAStools] are a set of simple command line tools  (including source code) for converting to/from ASCII, viewing, comparing, and compressing LIDAR data.&lt;br /&gt;
&lt;br /&gt;
* [http://www.liblas.org libLAS] ASPRS LiDAR data translation tools&lt;br /&gt;
&lt;br /&gt;
* See also [[LIDAR#Analysis|LIDAR Analysis]]&lt;br /&gt;
&lt;br /&gt;
== Micro-tutorial for LAS data==&lt;br /&gt;
&lt;br /&gt;
=== Preparation ===&lt;br /&gt;
&lt;br /&gt;
==== Conversion of text files to LAS ====&lt;br /&gt;
&lt;br /&gt;
[http://www.liblas.org/ libLAS] supports the following column types:&lt;br /&gt;
   x - x coordinate&lt;br /&gt;
   y - y coordinate&lt;br /&gt;
   z - z coordinate&lt;br /&gt;
   a - scan angle&lt;br /&gt;
   i - intensity&lt;br /&gt;
   n - number of returns for given pulse (1..n)&lt;br /&gt;
   r - number of this return (1..r)&lt;br /&gt;
   c - classification&lt;br /&gt;
   u - user data (but only 1 byte)&lt;br /&gt;
   p - point source ID&lt;br /&gt;
   e - edge of flight line&lt;br /&gt;
   d - direction of scan flag&lt;br /&gt;
   t - GPS time&lt;br /&gt;
   s - skip column&lt;br /&gt;
&lt;br /&gt;
Sample text data such as:&lt;br /&gt;
   returntime,pulse,east,north,height,intensity,stripe&lt;br /&gt;
   549778.907200,1,673999.940,5099680.080,507.425,20.0,45105&lt;br /&gt;
   ...&lt;br /&gt;
&lt;br /&gt;
can be converted to LAS format like this:&lt;br /&gt;
   returntime - t&lt;br /&gt;
   pulse - r&lt;br /&gt;
   east - x&lt;br /&gt;
   north - y&lt;br /&gt;
   height - z&lt;br /&gt;
   intensity - i&lt;br /&gt;
   stripe - s&lt;br /&gt;
&lt;br /&gt;
First parse (sanity check):&lt;br /&gt;
   txt2las -parse trxyzis data.asc&lt;br /&gt;
&lt;br /&gt;
Then convert:&lt;br /&gt;
   txt2las -parse trxyzis -i data.asc -o data.las &lt;br /&gt;
&lt;br /&gt;
While you may not need to do this conversion for GRASS import, the resulting files are way smaller than the uncompressed text files; additionally, they are in a defined format.&lt;br /&gt;
&lt;br /&gt;
=== LAS Import ===&lt;br /&gt;
&lt;br /&gt;
* Use the [http://www.liblas.org libLAS] utilities to import LAS data into GRASS. &lt;br /&gt;
* Data stored in text files can generally be imported directly into GRASS.&lt;br /&gt;
&lt;br /&gt;
* The data used in the rest of this micro-tutorial can be found at [http://www.appliedimagery.com/Serpent%20Mound%20Model%20LAS%20Data.las appliedimagery.com].&lt;br /&gt;
&lt;br /&gt;
==== Import LAS as raster DEM ====&lt;br /&gt;
&lt;br /&gt;
Check bounds and SRS:&lt;br /&gt;
 $ lasinfo &amp;quot;Serpent_Mound_Model_LAS_Data.las&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
  [...]&lt;br /&gt;
  Min X Y Z                  289020.900000 4320942.610000 166.780000&lt;br /&gt;
  Max X Y Z                  290106.020000 4323641.570000 215.480000&lt;br /&gt;
 Spatial Reference           +proj=utm +zone=17 +ellps=WGS84 +units=m &lt;br /&gt;
&lt;br /&gt;
After creating a suitable UTM zone 17 location (EPSG:32617) &lt;br /&gt;
set the region according to the information from lasinfo at 1m resolution, rounding grid outwards to align to whole meters:&lt;br /&gt;
 GRASS&amp;gt; {{cmd|g.region}} n=4323641.57 s=4320942.61 w=289020.90 e=290106.02 res=1 -ap&lt;br /&gt;
&lt;br /&gt;
Finally, import with {{cmd|r.in.xyz}} with data piped directly from the &amp;lt;tt&amp;gt;las2txt&amp;lt;/tt&amp;gt; program and set a nice equalized color table:&lt;br /&gt;
 BASEMAP=&amp;quot;Serpent_Mound_Model_LAS&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 las2txt --stdout &amp;quot;${BASEMAP}_Data.las&amp;quot; | \&lt;br /&gt;
    r.in.xyz in=- out=${BASEMAP}_Data fs=space method=mean&lt;br /&gt;
 &lt;br /&gt;
 {{cmd|r.colors}} ${BASEMAP}_Data color=bcyr -e&lt;br /&gt;
&lt;br /&gt;
The above example uses the default z-elevation level as the 3rd term, but by using the &amp;lt;tt&amp;gt;las2txt --parse&amp;lt;/tt&amp;gt; command other fields (such as intensity) can be imported instead via &amp;quot;&amp;lt;tt&amp;gt;--parse xyi&amp;lt;/tt&amp;gt;&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
==== Import LAS as vector points ====&lt;br /&gt;
&lt;br /&gt;
Region setting (establishing the grid) is not needed for vector features so we can go directly to the import step. To deal with millions of input points {{cmd|v.in.ascii}} should be run with the options to skip creation of an attribute database and building topology as these can consume large amounts of memory. Note that vector maps without topology built are somewhat limited in their ability to be processed. Most LIDAR specific modules have been adapted to not require &lt;br /&gt;
topology. Even so, after initial cleaning steps it is often more efficient to work with huge datasets in GRASS as raster data.&lt;br /&gt;
&lt;br /&gt;
 las2txt --stdout &amp;quot;${BASEMAP}_Data.las&amp;quot; | \&lt;br /&gt;
   v.in.ascii -tbz z=3 out=&amp;quot;${BASEMAP}_pts&amp;quot; fs=space&lt;br /&gt;
&lt;br /&gt;
If topology was built, you can use {{cmd|d.vect}}'s -z flag to colorize by elevation value. Without topology you can still colorize, but you need to use color rules based on absolute elevations, not percentage of scale.&lt;br /&gt;
&amp;lt;!-- need an absolute color map gradiated across the elev range --&amp;gt;&lt;br /&gt;
 # display colorized points for data with built topology&lt;br /&gt;
 d.vect map=lidar_pts size=1 -z zcolor=elevation&lt;br /&gt;
&lt;br /&gt;
* After import as points you can then use the v.lidar tools to clean the data: {{cmd|v.lidar.correction}}, {{cmd|v.lidar.edgedetection}}, {{cmd|v.lidar.growing}}, and {{cmd|v.outlier}}.&lt;br /&gt;
&lt;br /&gt;
* Vector points can be interpolated into raster DEMs with a number of modules, including {{cmd|v.surf.rst}}, {{cmd|v.surf.bspline}}, and {{cmd|v.surf.idw}}.&lt;br /&gt;
&lt;br /&gt;
=== Clean imported raster DEM ===&lt;br /&gt;
&lt;br /&gt;
(fill holes)&lt;br /&gt;
&lt;br /&gt;
 # convert to vector points&lt;br /&gt;
 r.to.vect -z feature=point in=${BASEMAP}_Data out=${BASEMAP}_pt&lt;br /&gt;
 &lt;br /&gt;
 # interpolate using a regularized spline fit&lt;br /&gt;
 # this is very slow, but produces very high quality output&lt;br /&gt;
 v.surf.rst layer=0 in=${BASEMAP}_pt elev=${BASEMAP}.rst&lt;br /&gt;
 &lt;br /&gt;
 # create 5m buffer area around original data points&lt;br /&gt;
 r.buffer in=${BASEMAP}_Data out=${BASEMAP}.5m_buff dist=5&lt;br /&gt;
 &lt;br /&gt;
 # crop interpolated DEM to only include areas nearby actual data&lt;br /&gt;
 r.mapcalc &amp;quot;${BASEMAP}.filled = \&lt;br /&gt;
    if( isnull(${BASEMAP}.5m_buff), null(), ${BASEMAP}.rst)&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 # set colors to something nice&lt;br /&gt;
 r.colors ${BASEMAP}.filled color=bcyr -e&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Depending on your needs, {{cmd|r.fillnulls}}, {{cmd|v.surf.bspline}}, {{cmd|v.surf.idw}}, {{cmd|r.surf.idw}}, {{cmd|r.surf.idw2}}, or [[GRASS_AddOns#r.surf.nnbathy|r.surf.nnbathy]] may be faster than the {{cmd|v.surf.rst}} method.&lt;br /&gt;
&lt;br /&gt;
=== Visualize raster DEM in 3D ===&lt;br /&gt;
&lt;br /&gt;
 nviz ${BASEMAP}.filled&lt;br /&gt;
&lt;br /&gt;
* Set z-exag to 2.0&lt;br /&gt;
* In Visualize &amp;amp;rarr; Raster Surfaces set the fine (final) resolution to 1, and coarse (preview) resolution to 5.&lt;br /&gt;
* Set the height to 500.0, the perspective to 15.0, and drag the view-puck to the North-West and reasonably zoomed in.&lt;br /&gt;
: You should now be able to see the serpent:&lt;br /&gt;
&lt;br /&gt;
[[Image:LAS_serpent_nviz.jpg|thumb|center|400px|The Great Serpent Mound, Adams County, Ohio, USA]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
It is possible to show vector points in 3D, but millions of them may make the program run slow. Topology is required ({{cmd|v.build}}). Tick the &amp;quot;3D&amp;quot; box in the Visualize &amp;amp;rarr; Vector points dialog.&lt;br /&gt;
&lt;br /&gt;
=== LAS Export ===&lt;br /&gt;
&lt;br /&gt;
==== Export to LAS ====&lt;br /&gt;
&lt;br /&gt;
This is the reverse of the import step, but using {{cmd|v.out.ascii}} or {{cmd|r.out.xyz}} with ''txt2las''.&lt;br /&gt;
Because the v.out.ascii module exports category number which we are not interested in, we cut it away with the UNIX ''cut'' utility.&lt;br /&gt;
&lt;br /&gt;
 v.out.ascii ${BASEMAP}_pts fs=space | cut -f1-3 -d' ' \&lt;br /&gt;
     &amp;gt; ${BASEMAP}_export.txt&lt;br /&gt;
 &lt;br /&gt;
 txt2las --parse xyz -i ${BASEMAP}_export.txt&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Micro-tutorial for LIDAR data analysis ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Simple analysis of single return data ===&lt;br /&gt;
&lt;br /&gt;
Data source: North Carolina sample data set (Lidar data from 2001, near Raleigh, North Carolina). Download from&lt;br /&gt;
   http://www.grassbook.org/ncexternal/&lt;br /&gt;
   -&amp;gt; File: BE3720079200WC20020829m.txt 3.6M (lidar bare earth points [spm])&lt;br /&gt;
&lt;br /&gt;
Scan input file for spatial extent. The -g flag shows the result in a convenient copy-paste format for {{cmd|g.region}}:&lt;br /&gt;
   r.in.xyz BE3720079200WC20020829m.txt out=dummy -s -g&lt;br /&gt;
&lt;br /&gt;
We use this output to set region, predefine 2m raster cells, and polish the odd coordinates with -a:&lt;br /&gt;
   g.region n=222504.439000 s=219456.442000 e=640081.274000 w=637033.274000 res=2 -a -p&lt;br /&gt;
&lt;br /&gt;
==== QUESTION 1: Are these Lidar data sufficiently dense? ====&lt;br /&gt;
&lt;br /&gt;
We compute a raster map representing number of points per cell&lt;br /&gt;
   r.in.xyz BE3720079200WC20020829m.txt out=lid_792_binn2m method=n&lt;br /&gt;
&lt;br /&gt;
Look at the resulting raster map:&lt;br /&gt;
   d.mon x0&lt;br /&gt;
   d.font Vera&lt;br /&gt;
   d.rast.leg lid_792_binn2m&lt;br /&gt;
&lt;br /&gt;
Report point distribution in percent:&lt;br /&gt;
   r.report lid_792_binn2m unit=p&lt;br /&gt;
&lt;br /&gt;
Reduce the resolution to 6m to get at least one point per cell:&lt;br /&gt;
   g.region res=6 -a -p&lt;br /&gt;
   r.in.xyz BE3720079200WC20020829m.txt out=lid_792_binn6m method=n&lt;br /&gt;
   d.rast.leg lid_792_binn6m&lt;br /&gt;
   # ... a few holes remain but that's probably acceptable.&lt;br /&gt;
&lt;br /&gt;
Compute raster maps representing mean elevation for each cell:&lt;br /&gt;
   r.in.xyz BE3720079200WC20020829m.txt out=lid_792_binmean6m  \&lt;br /&gt;
            meth=mean&lt;br /&gt;
   d.rast.leg lid_792_binmean6m&lt;br /&gt;
&lt;br /&gt;
Compute range and variation:&lt;br /&gt;
   r.in.xyz BE3720079200WC20020829m.txt out=lid_792_binrange6m \&lt;br /&gt;
            meth=range&lt;br /&gt;
   d.rast.leg lid_792_binrange6m&lt;br /&gt;
   r.in.xyz BE3720079200WC20020829m.txt out=lid_792_binvar6m   \&lt;br /&gt;
            meth=coeff_var&lt;br /&gt;
   d.rast.leg lid_792_binvar6m&lt;br /&gt;
&lt;br /&gt;
Overlay other GIS maps to map of mean elevation:&lt;br /&gt;
   d.rast.leg lid_792_binmean6m&lt;br /&gt;
   d.vect streets_wake&lt;br /&gt;
   d.vect lakes type=boundary&lt;br /&gt;
   d.vect streams&lt;br /&gt;
&lt;br /&gt;
Now we continue to work in a zoomed spatial subset of the area.&lt;br /&gt;
&lt;br /&gt;
We import only points in the rural area without building topology and using z-coordinate for elevation:&lt;br /&gt;
   g.region rural_1m -p&lt;br /&gt;
   v.in.ascii -ztbr BE3720079200WC20020829m.txt \&lt;br /&gt;
              out=elev_lidrural_bepts z=3&lt;br /&gt;
&lt;br /&gt;
Clear monitor show black-white orthophoto:&lt;br /&gt;
   d.erase -f&lt;br /&gt;
   d.rast ortho_2001_t792_1m&lt;br /&gt;
&lt;br /&gt;
We now use already prepared Lidar vector point maps:&lt;br /&gt;
* elev_lid792_bepts:   Rural area (in tile 792), bare earth lidar point cloud&lt;br /&gt;
* elev_lidrural_mrpts: Rural area multiple return lidar point cloud&lt;br /&gt;
&lt;br /&gt;
Look at ground data:&lt;br /&gt;
d.vect elev_lidrural_bepts siz=2 col=red&lt;br /&gt;
&lt;br /&gt;
Look at &amp;quot;surface&amp;quot; data:&lt;br /&gt;
d.vect elev_lidrural_mrpts siz=1 col=green&lt;br /&gt;
&lt;br /&gt;
Visualize 3D Lidar multi-return points:&lt;br /&gt;
nviz elev_lid792_1m point=elev_lidrural_mrpts&lt;br /&gt;
 # Visualize -&amp;gt; Vector Points -&amp;gt; 3D points&lt;br /&gt;
 #                            -&amp;gt; Icon size 2.25&lt;br /&gt;
 #  --&amp;gt; GRASS book p. 253, fig. 3.15 (see also screenshot [http://www.grassbook.org/about_menu3rd.php here])&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== DEM/DSM separation the simple way by selection of Lidar returns ====&lt;br /&gt;
&lt;br /&gt;
Find out where we have multiple returns:&lt;br /&gt;
   d.rast ortho_2001_t792_1m&lt;br /&gt;
   d.vect elev_lidrural_mrpts where=&amp;quot;return=1&amp;quot; col=red siz=2&lt;br /&gt;
   d.vect elev_lidrural_mrpts where=&amp;quot;return=2&amp;quot; col=green siz=3&lt;br /&gt;
   d.vect elev_lidrural_mrpts where=&amp;quot;return=3&amp;quot; col=blue&lt;br /&gt;
   d.vect elev_lidrural_mrpts where=&amp;quot;return=4&amp;quot; col=yellow&lt;br /&gt;
&lt;br /&gt;
DTM: extract last return(s):&lt;br /&gt;
   v.extract elev_lidrural_mrpts out=elev_lidrural_mrpts_first where=&amp;quot;Return &amp;lt; 2&amp;quot;&lt;br /&gt;
   nviz elev_lid792_1m point=elev_lidrural_mrpts_first&lt;br /&gt;
&lt;br /&gt;
Interpolate to map and look at it:&lt;br /&gt;
   v.surf.rst elev_lidrural_mrpts_first layer=0 elev=elev_lidrural_mrpts_DTM&lt;br /&gt;
   nviz elev_lidrural_mrpts_DTM col=ortho_2001_t792_1m&lt;br /&gt;
&lt;br /&gt;
DSM: extract first return(s):&lt;br /&gt;
   v.extract elev_lidrural_mrpts out=elev_lidrural_mrpts_last where=&amp;quot;Return &amp;gt; 2&amp;quot;&lt;br /&gt;
   nviz elev_lid792_1m point=elev_lidrural_mrpts_last&lt;br /&gt;
&lt;br /&gt;
Interpolate to map and look at it:&lt;br /&gt;
   v.surf.rst elev_lidrural_mrpts_first layer=0 elev=elev_lidrural_mrpts_DSM&lt;br /&gt;
   nviz elev_lidrural_mrpts_DSM col=ortho_2001_t792_1m&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== DEM/DSM separation the more complex way ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;''TODO: verify order of first and last returns in below text''&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
General procedure:&lt;br /&gt;
* Lidar point clouds (first and last return) are imported with {{cmd|v.in.ascii}} (-b flag to not build the topology).&lt;br /&gt;
* Outlier detection is done with {{cmd|v.outlier}} on both first and last return data (NB. currently a selection of &amp;lt;/=4 for soe/son in {{cmd|v.outlier}} results in an error message).&lt;br /&gt;
* Then, with {{cmd|v.lidar.edgedetection}}, edges are detected from last return data.&lt;br /&gt;
* The building are generated by {{cmd|v.lidar.growing}} from detected edges.&lt;br /&gt;
* The resulting data are post-processed with {{cmd|v.lidar.correction}}.&lt;br /&gt;
* Finally, the DTM and DSM are generated with {{cmd|v.surf.bspline}} (DTM: uses the 'v.lidar.correction' output; DSM: uses last return output from outlier detection).&lt;br /&gt;
&lt;br /&gt;
  export GRASS_OVERWRITE=1&lt;br /&gt;
  v.extract elev_lidrural_mrpts out=elev_lidfirst_pts \&lt;br /&gt;
            where=&amp;quot;return = 1&amp;quot;&lt;br /&gt;
  v.extract elev_lidrural_mrpts out=elev_lidlast_pts  \&lt;br /&gt;
            where=&amp;quot;return &amp;gt;= 2&amp;quot;&lt;br /&gt;
  d.vect elev_lidfirst_pts col=red&lt;br /&gt;
  d.vect elev_lidlast_pts col=green&lt;br /&gt;
&lt;br /&gt;
Outlier detection and separation into two maps&lt;br /&gt;
  # 1st return&lt;br /&gt;
  v.outlier elev_lidfirst_pts output=elev_lidfirst_clean \&lt;br /&gt;
            outlier=elev_lidfirst_outl&lt;br /&gt;
  d.erase&lt;br /&gt;
  d.vect elev_lidfirst_clean siz=2&lt;br /&gt;
  d.vect elev_lidfirst_outl col=red&lt;br /&gt;
&lt;br /&gt;
2nd return&lt;br /&gt;
  v.outlier elev_lidlast_pts output=elev_lidlast_clean \&lt;br /&gt;
            outlier=elev_lidlast_outl&lt;br /&gt;
  d.erase&lt;br /&gt;
  d.vect elev_lidlast_clean siz=2&lt;br /&gt;
  d.vect elev_lidlast_outl col=red&lt;br /&gt;
  # -&amp;gt; no outliers visible&lt;br /&gt;
&lt;br /&gt;
Run an edge detection on cleaned last return:&lt;br /&gt;
  v.lidar.edgedetection elev_lidlast_clean \&lt;br /&gt;
                        out=elev_lidlast_edges&lt;br /&gt;
&lt;br /&gt;
Buildings/vegetation are generated from detected edges (bug: you may need to specify the mapset):&lt;br /&gt;
  v.lidar.growing elev_lidlast_edges@lidar out=elev_lidlast_grow \&lt;br /&gt;
                  first=elev_lidfirst_clean&lt;br /&gt;
&lt;br /&gt;
Compare:&lt;br /&gt;
  d.vect elev_lidlast_pts col=blue&lt;br /&gt;
  d.vect elev_lidlast_grow col=green&lt;br /&gt;
&lt;br /&gt;
Correction (this is applied twice):&lt;br /&gt;
  v.lidar.correction elev_lidlast_grow out=elev_lidlast_corr1 \&lt;br /&gt;
                     terrain=elev_lidlast_terr1&lt;br /&gt;
  v.lidar.correction elev_lidlast_corr1 out=elev_lid_dsm \&lt;br /&gt;
                     terrain=elev_lid_dtm&lt;br /&gt;
&lt;br /&gt;
DEM and DSM are generated:&lt;br /&gt;
  # Estimation of lambda_i parameter with cross validation (watch for RMS!)&lt;br /&gt;
  v.surf.bspline -c elev_lid_dsm sie=100 sin=100&lt;br /&gt;
  v.surf.bspline -c elev_lid_dtm sie=100 sin=100&lt;br /&gt;
  &lt;br /&gt;
  # From the cross-validation, we select lambda with minimal RMS error:&lt;br /&gt;
  # generate raster surfaces at 1m resolution&lt;br /&gt;
  v.surf.bspline elev_lid_dsm raster=lidar_dsm lambda=0.1&lt;br /&gt;
  v.surf.bspline elev_lid_dtm raster=lidar_dtm lambda=0.0001&lt;br /&gt;
  &lt;br /&gt;
  d.rast lidar_dsm&lt;br /&gt;
  d.rast lidar_dtm&lt;br /&gt;
  &lt;br /&gt;
  nviz lidar_dsm,lidar_dtm \&lt;br /&gt;
       col=ortho_2001_t792_1m,ortho_2001_t792_1m&lt;br /&gt;
&lt;br /&gt;
...with the position slider you can visually separate DSM and DEM, increase z slider (Visualize -&amp;gt; Raster Surface -&amp;gt; Position).&lt;br /&gt;
&lt;br /&gt;
== Sample LIDAR data ==&lt;br /&gt;
&lt;br /&gt;
=== Widely used in GRASS tutorials ===&lt;br /&gt;
&lt;br /&gt;
* [http://www.grassbook.org/data_menu2nd.php Jockey's Ridge, NC, LIDAR dataset]&lt;br /&gt;
* [http://www.grassbook.org/data_menu3rd.php North Carolina OSGeo Edu data set] (includes multi-return LIDAR data)&lt;br /&gt;
&lt;br /&gt;
=== Other ===&lt;br /&gt;
&lt;br /&gt;
* United States Antarctic Resource Center: LIDAR High-resolution DEM Final DATA Downloads&amp;lt;BR&amp;gt;http://usarc.usgs.gov/lidar_dload.shtml&lt;br /&gt;
&lt;br /&gt;
* LIDAR ALSM Research, Arizona State University Ative Tectonics, Research Group&amp;lt;BR&amp;gt;  http://lidar.asu.edu/research.html and http://www.geongrid.org/science/lidar.html&lt;br /&gt;
&lt;br /&gt;
* USGS Center for LIDAR Information Coordination and Knowledge (aka CLICK) - USGS LiDAR point cloud distribution site&amp;lt;BR&amp;gt; http://lidar.cr.usgs.gov&lt;br /&gt;
&lt;br /&gt;
* Washington State Geospatial Data Archive, Mount Saint Helens - Lidar Data &amp;lt;BR&amp;gt;https://wagda.lib.washington.edu/data/type/elevation/lidar/st_helens/&lt;br /&gt;
&lt;br /&gt;
* Puget Sound Lidar Consortium, public-domain high-resolution topography for western Washington&amp;lt;BR&amp;gt;http://pugetsoundlidar.ess.washington.edu/index.htm&lt;br /&gt;
&lt;br /&gt;
* NOAA Topographic Change Mapping LIDAR Data Retrieval Tool (LDART) NOAA Coastal Services Center&amp;lt;BR&amp;gt;http://maps.csc.noaa.gov/TCM/&lt;br /&gt;
&lt;br /&gt;
* Landmap, LIDAR Data from the Environment Agency &amp;lt;BR&amp;gt;http://www.landmap.ac.uk/lidar/lidar.html&lt;br /&gt;
&lt;br /&gt;
* Northern California LIDAR data &amp;lt;BR&amp;gt;http://quake.usgs.gov/research/geology/lidar/  and http://core2.gsfc.nasa.gov/lidar/terrapoint/&lt;br /&gt;
&lt;br /&gt;
* IDAHO GEOSPATIAL , Bare Earth LIDAR DEM Download - UTM &amp;lt;BR&amp;gt;http://inside.uidaho.edu/geodata/LiDAR/LiDARBareEarthDEM_DownloadUTM.htm&lt;br /&gt;
&lt;br /&gt;
* EarthScope Spatial Data Explorer - A java application for querying, browsing, and acquiring data from the EarthScope Spatial Data Repository. Currently includes a number of LiDAR datasets. &amp;lt;BR&amp;gt;http://www.earthscope.org/data/lidar.php&lt;br /&gt;
&lt;br /&gt;
* LIDAR Galley &amp;lt;BR&amp;gt;https://peoiewswebinfo.monmouth.army.mil/JPSD/LIDAR_Gallery.htm&lt;br /&gt;
&lt;br /&gt;
* South Tyrol - Download of DTMs (Homepage in German or Italian) &amp;lt;BR&amp;gt; http://www.provinz.bz.it/raumordnung/grundkarten/utm/default_d.htm&lt;br /&gt;
&lt;br /&gt;
== Links ==&lt;br /&gt;
&lt;br /&gt;
* [http://liblas.org/ libLAS] - LAS 1.0/1.1 ASPRS LiDAR data translation toolset&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>⚠️John Tate</name></author>
	</entry>
	<entry>
		<id>https://grasswiki.osgeo.org/w/index.php?title=LIDAR&amp;diff=9858</id>
		<title>LIDAR</title>
		<link rel="alternate" type="text/html" href="https://grasswiki.osgeo.org/w/index.php?title=LIDAR&amp;diff=9858"/>
		<updated>2009-11-05T13:09:45Z</updated>

		<summary type="html">&lt;p&gt;⚠️John Tate: /* DEM/DSM separation the more complex way */  deleted previous edit&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;h1&amp;gt; LIDAR and Multi-beam Swath bathymetry data &amp;lt;/h1&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Modules ==&lt;br /&gt;
&lt;br /&gt;
=== Import ===&lt;br /&gt;
&lt;br /&gt;
* {{cmd|r.in.xyz}} - Create a raster map from an assemblage of many coordinates using univariate statistics. ([http://hamish.bowman.googlepages.com/grassfiles#xyz example])&lt;br /&gt;
&lt;br /&gt;
* {{cmd|v.in.ascii}} - Import data from an ASCII file to GRASS vector format.&lt;br /&gt;
: ''Due to memory overhead vector point imports will be limited to a few million data points unless topology and database creation is skipped with the '''-bt''' flags''. It may also be useful to clip the import file to only accept points falling within the current region by using the '''-r''' flag. See {{cmd|g.region}} for details on specifying the region bounds.&lt;br /&gt;
&lt;br /&gt;
=== Analysis ===&lt;br /&gt;
&lt;br /&gt;
* {{cmd|v.outlier}} - Removes outliers from vector point data.&lt;br /&gt;
&lt;br /&gt;
* {{cmd|v.lidar.edgedetection}} - Detect the object's edges from a LIDAR data set.&lt;br /&gt;
&lt;br /&gt;
* {{cmd|v.lidar.growing}} - Building contour determination and Region Growing algorithm for determining the building inside.&lt;br /&gt;
&lt;br /&gt;
* {{cmd|v.lidar.correction}} - Correction of the v.lidar.growing output. It is the last of the three algorithms for LIDAR filtering.&lt;br /&gt;
&lt;br /&gt;
=== Surface generation ===&lt;br /&gt;
&lt;br /&gt;
* {{cmd|v.surf.rst}} - Spatial approximation and topographic analysis using regularized spline with tension.&lt;br /&gt;
&lt;br /&gt;
* {{cmd|v.surf.idw}} - Surface interpolation from vector point data by Inverse Distance Squared Weighting.&lt;br /&gt;
&lt;br /&gt;
* {{cmd|v.surf.bspline}} - Surface interpolation from vector point data by bicubic or bilineal interpolation with Tykhonov regularization.&lt;br /&gt;
&lt;br /&gt;
* {{cmd|r.fillnulls}} - Fills no-data areas in raster maps using v.surf.rst splines interpolation.&lt;br /&gt;
&lt;br /&gt;
== Swath Bathymetry Tools ==&lt;br /&gt;
&lt;br /&gt;
''see also the [[Marine_Science#Multibeam_sonar_processing]] wiki page''&lt;br /&gt;
&lt;br /&gt;
* The [http://david.p.finlayson.googlepages.com/swathwidth v.swathwidith] module by David Finlayson for planning surveys. (development page)&lt;br /&gt;
&lt;br /&gt;
* An example of [http://bambi.otago.ac.nz/hamish/grass/gdal/sidescan_warp.html post-processing scanned paper sidescan swaths] using thin plate spline warping with [http://www.gdal.org/ GDAL's] &amp;quot;&amp;lt;tt&amp;gt;gdalwarp -tps&amp;lt;/tt&amp;gt;&amp;quot; function. (debugging page)&lt;br /&gt;
&lt;br /&gt;
* [[Marine_Science#Import_into_GRASS|GRASS integration]] with [http://www.ldeo.columbia.edu/res/pi/MB-System/ MB-System] (GPL) software for processing Multibeam and Sidescan Sonar data. GRASS + MBsys + [[GMT]] make a nice scriptable trio.&lt;br /&gt;
&lt;br /&gt;
== LIDAR Tools ==&lt;br /&gt;
&lt;br /&gt;
*  {{cmd|r.terraflow}} - computation of flow direction, flow accumulation and other basic topographic terrain indices from massive raster digital elevation models (DEM). From the Duke University [http://terrain.cs.duke.edu/ STREAM] project.&lt;br /&gt;
&lt;br /&gt;
* [http://mpa.itc.it/markus/grass61/demos/rlake/ Flood simulation] using {{cmd|r.lake}}. Includes fancy NVIZ visualization of Trento, Italy, by Markus Neteler.&lt;br /&gt;
&lt;br /&gt;
* [http://www.cs.unc.edu/~isenburg/software/ LAStools] are a set of simple command line tools  (including source code) for converting to/from ASCII, viewing, comparing, and compressing LIDAR data.&lt;br /&gt;
&lt;br /&gt;
* [http://www.liblas.org libLAS] ASPRS LiDAR data translation tools&lt;br /&gt;
&lt;br /&gt;
* See also [[LIDAR#Analysis|LIDAR Analysis]]&lt;br /&gt;
&lt;br /&gt;
== Micro-tutorial for LAS data==&lt;br /&gt;
&lt;br /&gt;
=== Preparation ===&lt;br /&gt;
&lt;br /&gt;
==== Conversion of text files to LAS ====&lt;br /&gt;
&lt;br /&gt;
[http://www.liblas.org/ libLAS] supports the following column types:&lt;br /&gt;
   x - x coordinate&lt;br /&gt;
   y - y coordinate&lt;br /&gt;
   z - z coordinate&lt;br /&gt;
   a - scan angle&lt;br /&gt;
   i - intensity&lt;br /&gt;
   n - number of returns for given pulse (1..n)&lt;br /&gt;
   r - number of this return (1..r)&lt;br /&gt;
   c - classification&lt;br /&gt;
   u - user data (but only 1 byte)&lt;br /&gt;
   p - point source ID&lt;br /&gt;
   e - edge of flight line&lt;br /&gt;
   d - direction of scan flag&lt;br /&gt;
   t - GPS time&lt;br /&gt;
   s - skip column&lt;br /&gt;
&lt;br /&gt;
Sample text data such as:&lt;br /&gt;
   returntime,pulse,east,north,height,intensity,stripe&lt;br /&gt;
   549778.907200,1,673999.940,5099680.080,507.425,20.0,45105&lt;br /&gt;
   ...&lt;br /&gt;
&lt;br /&gt;
can be converted to LAS format like this:&lt;br /&gt;
   returntime - t&lt;br /&gt;
   pulse - r&lt;br /&gt;
   east - x&lt;br /&gt;
   north - y&lt;br /&gt;
   height - z&lt;br /&gt;
   intensity - i&lt;br /&gt;
   stripe - s&lt;br /&gt;
&lt;br /&gt;
First parse (sanity check):&lt;br /&gt;
   txt2las -parse trxyzis data.asc&lt;br /&gt;
&lt;br /&gt;
Then convert:&lt;br /&gt;
   txt2las -parse trxyzis -i data.asc -o data.las &lt;br /&gt;
&lt;br /&gt;
While you may not need to do this conversion for GRASS import, the resulting files are way smaller than the uncompressed text files; additionally, they are in a defined format.&lt;br /&gt;
&lt;br /&gt;
=== LAS Import ===&lt;br /&gt;
&lt;br /&gt;
* Use the [http://www.liblas.org libLAS] utilities to import LAS data into GRASS. &lt;br /&gt;
* Data stored in text files can generally be imported directly into GRASS.&lt;br /&gt;
&lt;br /&gt;
* The data used in the rest of this micro-tutorial can be found at [http://www.appliedimagery.com/Serpent%20Mound%20Model%20LAS%20Data.las appliedimagery.com].&lt;br /&gt;
&lt;br /&gt;
==== Import LAS as raster DEM ====&lt;br /&gt;
&lt;br /&gt;
Check bounds and SRS:&lt;br /&gt;
 $ lasinfo &amp;quot;Serpent_Mound_Model_LAS_Data.las&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
  [...]&lt;br /&gt;
  Min X Y Z                  289020.900000 4320942.610000 166.780000&lt;br /&gt;
  Max X Y Z                  290106.020000 4323641.570000 215.480000&lt;br /&gt;
 Spatial Reference           +proj=utm +zone=17 +ellps=WGS84 +units=m &lt;br /&gt;
&lt;br /&gt;
After creating a suitable UTM zone 17 location (EPSG:32617) &lt;br /&gt;
set the region according to the information from lasinfo at 1m resolution, rounding grid outwards to align to whole meters:&lt;br /&gt;
 GRASS&amp;gt; {{cmd|g.region}} n=4323641.57 s=4320942.61 w=289020.90 e=290106.02 res=1 -ap&lt;br /&gt;
&lt;br /&gt;
Finally, import with {{cmd|r.in.xyz}} with data piped directly from the &amp;lt;tt&amp;gt;las2txt&amp;lt;/tt&amp;gt; program and set a nice equalized color table:&lt;br /&gt;
 BASEMAP=&amp;quot;Serpent_Mound_Model_LAS&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 las2txt --stdout &amp;quot;${BASEMAP}_Data.las&amp;quot; | \&lt;br /&gt;
    r.in.xyz in=- out=${BASEMAP}_Data fs=space method=mean&lt;br /&gt;
 &lt;br /&gt;
 {{cmd|r.colors}} ${BASEMAP}_Data color=bcyr -e&lt;br /&gt;
&lt;br /&gt;
The above example uses the default z-elevation level as the 3rd term, but by using the &amp;lt;tt&amp;gt;las2txt --parse&amp;lt;/tt&amp;gt; command other fields (such as intensity) can be imported instead via &amp;quot;&amp;lt;tt&amp;gt;--parse xyi&amp;lt;/tt&amp;gt;&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
==== Import LAS as vector points ====&lt;br /&gt;
&lt;br /&gt;
Region setting (establishing the grid) is not needed for vector features so we can go directly to the import step. To deal with millions of input points {{cmd|v.in.ascii}} should be run with the options to skip creation of an attribute database and building topology as these can consume large amounts of memory. Note that vector maps without topology built are somewhat limited in their ability to be processed. Most LIDAR specific modules have been adapted to not require &lt;br /&gt;
topology. Even so, after initial cleaning steps it is often more efficient to work with huge datasets in GRASS as raster data.&lt;br /&gt;
&lt;br /&gt;
 las2txt --stdout &amp;quot;${BASEMAP}_Data.las&amp;quot; | \&lt;br /&gt;
   v.in.ascii -tbz z=3 out=&amp;quot;${BASEMAP}_pts&amp;quot; fs=space&lt;br /&gt;
&lt;br /&gt;
If topology was built, you can use {{cmd|d.vect}}'s -z flag to colorize by elevation value. Without topology you can still colorize, but you need to use color rules based on absolute elevations, not percentage of scale.&lt;br /&gt;
&amp;lt;!-- need an absolute color map gradiated across the elev range --&amp;gt;&lt;br /&gt;
 # display colorized points for data with built topology&lt;br /&gt;
 d.vect map=lidar_pts size=1 -z zcolor=elevation&lt;br /&gt;
&lt;br /&gt;
* After import as points you can then use the v.lidar tools to clean the data: {{cmd|v.lidar.correction}}, {{cmd|v.lidar.edgedetection}}, {{cmd|v.lidar.growing}}, and {{cmd|v.outlier}}.&lt;br /&gt;
&lt;br /&gt;
* Vector points can be interpolated into raster DEMs with a number of modules, including {{cmd|v.surf.rst}}, {{cmd|v.surf.bspline}}, and {{cmd|v.surf.idw}}.&lt;br /&gt;
&lt;br /&gt;
=== Clean imported raster DEM ===&lt;br /&gt;
&lt;br /&gt;
(fill holes)&lt;br /&gt;
&lt;br /&gt;
 # convert to vector points&lt;br /&gt;
 r.to.vect -z feature=point in=${BASEMAP}_Data out=${BASEMAP}_pt&lt;br /&gt;
 &lt;br /&gt;
 # interpolate using a regularized spline fit&lt;br /&gt;
 # this is very slow, but produces very high quality output&lt;br /&gt;
 v.surf.rst layer=0 in=${BASEMAP}_pt elev=${BASEMAP}.rst&lt;br /&gt;
 &lt;br /&gt;
 # create 5m buffer area around original data points&lt;br /&gt;
 r.buffer in=${BASEMAP}_Data out=${BASEMAP}.5m_buff dist=5&lt;br /&gt;
 &lt;br /&gt;
 # crop interpolated DEM to only include areas nearby actual data&lt;br /&gt;
 r.mapcalc &amp;quot;${BASEMAP}.filled = \&lt;br /&gt;
    if( isnull(${BASEMAP}.5m_buff), null(), ${BASEMAP}.rst)&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 # set colors to something nice&lt;br /&gt;
 r.colors ${BASEMAP}.filled color=bcyr -e&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Depending on your needs, {{cmd|r.fillnulls}}, {{cmd|v.surf.bspline}}, {{cmd|v.surf.idw}}, {{cmd|r.surf.idw}}, {{cmd|r.surf.idw2}}, or [[GRASS_AddOns#r.surf.nnbathy|r.surf.nnbathy]] may be faster than the {{cmd|v.surf.rst}} method.&lt;br /&gt;
&lt;br /&gt;
=== Visualize raster DEM in 3D ===&lt;br /&gt;
&lt;br /&gt;
 nviz ${BASEMAP}.filled&lt;br /&gt;
&lt;br /&gt;
* Set z-exag to 2.0&lt;br /&gt;
* In Visualize &amp;amp;rarr; Raster Surfaces set the fine (final) resolution to 1, and coarse (preview) resolution to 5.&lt;br /&gt;
* Set the height to 500.0, the perspective to 15.0, and drag the view-puck to the North-West and reasonably zoomed in.&lt;br /&gt;
: You should now be able to see the serpent:&lt;br /&gt;
&lt;br /&gt;
[[Image:LAS_serpent_nviz.jpg|thumb|center|400px|The Great Serpent Mound, Adams County, Ohio, USA]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
It is possible to show vector points in 3D, but millions of them may make the program run slow. Topology is required ({{cmd|v.build}}). Tick the &amp;quot;3D&amp;quot; box in the Visualize &amp;amp;rarr; Vector points dialog.&lt;br /&gt;
&lt;br /&gt;
=== LAS Export ===&lt;br /&gt;
&lt;br /&gt;
==== Export to LAS ====&lt;br /&gt;
&lt;br /&gt;
This is the reverse of the import step, but using {{cmd|v.out.ascii}} or {{cmd|r.out.xyz}} with ''txt2las''.&lt;br /&gt;
Because the v.out.ascii module exports category number which we are not interested in, we cut it away with the UNIX ''cut'' utility.&lt;br /&gt;
&lt;br /&gt;
 v.out.ascii ${BASEMAP}_pts fs=space | cut -f1-3 -d' ' \&lt;br /&gt;
     &amp;gt; ${BASEMAP}_export.txt&lt;br /&gt;
 &lt;br /&gt;
 txt2las --parse xyz -i ${BASEMAP}_export.txt&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Micro-tutorial for LIDAR data analysis ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Simple analysis of single return data ===&lt;br /&gt;
&lt;br /&gt;
Data source: North Carolina sample data set (Lidar data from 2001, near Raleigh, North Carolina). Download from&lt;br /&gt;
   http://www.grassbook.org/ncexternal/&lt;br /&gt;
   -&amp;gt; File: BE3720079200WC20020829m.txt 3.6M (lidar bare earth points [spm])&lt;br /&gt;
&lt;br /&gt;
Scan input file for spatial extent. The -g flag shows the result in a convenient copy-paste format for {{cmd|g.region}}:&lt;br /&gt;
   r.in.xyz BE3720079200WC20020829m.txt out=dummy -s -g&lt;br /&gt;
&lt;br /&gt;
We use this output to set region, predefine 2m raster cells, and polish the odd coordinates with -a:&lt;br /&gt;
   g.region n=222504.439000 s=219456.442000 e=640081.274000 w=637033.274000 res=2 -a -p&lt;br /&gt;
&lt;br /&gt;
==== QUESTION 1: Are these Lidar data sufficiently dense? ====&lt;br /&gt;
&lt;br /&gt;
We compute a raster map representing number of points per cell&lt;br /&gt;
   r.in.xyz BE3720079200WC20020829m.txt out=lid_792_binn2m method=n&lt;br /&gt;
&lt;br /&gt;
Look at the resulting raster map:&lt;br /&gt;
   d.mon x0&lt;br /&gt;
   d.font Vera&lt;br /&gt;
   d.rast.leg lid_792_binn2m&lt;br /&gt;
&lt;br /&gt;
Report point distribution in percent:&lt;br /&gt;
   r.report lid_792_binn2m unit=p&lt;br /&gt;
&lt;br /&gt;
Reduce the resolution to 6m to get at least one point per cell:&lt;br /&gt;
   g.region res=6 -a -p&lt;br /&gt;
   r.in.xyz BE3720079200WC20020829m.txt out=lid_792_binn6m method=n&lt;br /&gt;
   d.rast.leg lid_792_binn6m&lt;br /&gt;
   # ... a few holes remain but that's probably acceptable.&lt;br /&gt;
&lt;br /&gt;
Compute raster maps representing mean elevation for each cell:&lt;br /&gt;
   r.in.xyz BE3720079200WC20020829m.txt out=lid_792_binmean6m  \&lt;br /&gt;
            meth=mean&lt;br /&gt;
   d.rast.leg lid_792_binmean6m&lt;br /&gt;
&lt;br /&gt;
Compute range and variation:&lt;br /&gt;
   r.in.xyz BE3720079200WC20020829m.txt out=lid_792_binrange6m \&lt;br /&gt;
            meth=range&lt;br /&gt;
   d.rast.leg lid_792_binrange6m&lt;br /&gt;
   r.in.xyz BE3720079200WC20020829m.txt out=lid_792_binvar6m   \&lt;br /&gt;
            meth=coeff_var&lt;br /&gt;
   d.rast.leg lid_792_binvar6m&lt;br /&gt;
&lt;br /&gt;
Overlay other GIS maps to map of mean elevation:&lt;br /&gt;
   d.rast.leg lid_792_binmean6m&lt;br /&gt;
   d.vect streets_wake&lt;br /&gt;
   d.vect lakes type=boundary&lt;br /&gt;
   d.vect streams&lt;br /&gt;
&lt;br /&gt;
Now we continue to work in a zoomed spatial subset of the area.&lt;br /&gt;
&lt;br /&gt;
We import only points in the rural area without building topology and using z-coordinate for elevation:&lt;br /&gt;
   g.region rural_1m -p&lt;br /&gt;
   v.in.ascii -ztbr BE3720079200WC20020829m.txt \&lt;br /&gt;
              out=elev_lidrural_bepts z=3&lt;br /&gt;
&lt;br /&gt;
Clear monitor show black-white orthophoto:&lt;br /&gt;
   d.erase -f&lt;br /&gt;
   d.rast ortho_2001_t792_1m&lt;br /&gt;
&lt;br /&gt;
We now use already prepared Lidar vector point maps:&lt;br /&gt;
* elev_lid792_bepts:   Rural area (in tile 792), bare earth lidar point cloud&lt;br /&gt;
* elev_lidrural_mrpts: Rural area multiple return lidar point cloud&lt;br /&gt;
&lt;br /&gt;
Look at ground data:&lt;br /&gt;
d.vect elev_lidrural_bepts siz=2 col=red&lt;br /&gt;
&lt;br /&gt;
Look at &amp;quot;surface&amp;quot; data:&lt;br /&gt;
d.vect elev_lidrural_mrpts siz=1 col=green&lt;br /&gt;
&lt;br /&gt;
Visualize 3D Lidar multi-return points:&lt;br /&gt;
nviz elev_lid792_1m point=elev_lidrural_mrpts&lt;br /&gt;
 # Visualize -&amp;gt; Vector Points -&amp;gt; 3D points&lt;br /&gt;
 #                            -&amp;gt; Icon size 2.25&lt;br /&gt;
 #  --&amp;gt; GRASS book p. 253, fig. 3.15 (see also screenshot [http://www.grassbook.org/about_menu3rd.php here])&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== DEM/DSM separation the simple way by selection of Lidar returns ====&lt;br /&gt;
&lt;br /&gt;
Find out where we have multiple returns:&lt;br /&gt;
   d.rast ortho_2001_t792_1m&lt;br /&gt;
   d.vect elev_lidrural_mrpts where=&amp;quot;return=1&amp;quot; col=red siz=2&lt;br /&gt;
   d.vect elev_lidrural_mrpts where=&amp;quot;return=2&amp;quot; col=green siz=3&lt;br /&gt;
   d.vect elev_lidrural_mrpts where=&amp;quot;return=3&amp;quot; col=blue&lt;br /&gt;
   d.vect elev_lidrural_mrpts where=&amp;quot;return=4&amp;quot; col=yellow&lt;br /&gt;
&lt;br /&gt;
DTM: extract last return(s):&lt;br /&gt;
   v.extract elev_lidrural_mrpts out=elev_lidrural_mrpts_first where=&amp;quot;Return &amp;lt; 2&amp;quot;&lt;br /&gt;
   nviz elev_lid792_1m point=elev_lidrural_mrpts_first&lt;br /&gt;
&lt;br /&gt;
Interpolate to map and look at it:&lt;br /&gt;
   v.surf.rst elev_lidrural_mrpts_first layer=0 elev=elev_lidrural_mrpts_DTM&lt;br /&gt;
   nviz elev_lidrural_mrpts_DTM col=ortho_2001_t792_1m&lt;br /&gt;
&lt;br /&gt;
DSM: extract first return(s):&lt;br /&gt;
   v.extract elev_lidrural_mrpts out=elev_lidrural_mrpts_last where=&amp;quot;Return &amp;gt; 2&amp;quot;&lt;br /&gt;
   nviz elev_lid792_1m point=elev_lidrural_mrpts_last&lt;br /&gt;
&lt;br /&gt;
Interpolate to map and look at it:&lt;br /&gt;
   v.surf.rst elev_lidrural_mrpts_first layer=0 elev=elev_lidrural_mrpts_DSM&lt;br /&gt;
   nviz elev_lidrural_mrpts_DSM col=ortho_2001_t792_1m&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== DEM/DSM separation the more complex way ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;''TODO: verify order of first and last returns in below text''&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
General procedure:&lt;br /&gt;
* Lidar point clouds (first and last return) are imported with {{cmd|v.in.ascii}} (-b flag to not build the topology).&lt;br /&gt;
* Outlier detection is done with {{cmd|v.outlier}} on both first and last return data.&lt;br /&gt;
* Then, with {{cmd|v.lidar.edgedetection}}, edges are detected from last return data.&lt;br /&gt;
* The building are generated by {{cmd|v.lidar.growing}} from detected edges.&lt;br /&gt;
* The resulting data are post-processed with {{cmd|v.lidar.correction}}.&lt;br /&gt;
* Finally, the DTM and DSM are generated with {{cmd|v.surf.bspline}} (DTM: uses the 'v.lidar.correction' output; DSM: uses last return output from outlier detection).&lt;br /&gt;
&lt;br /&gt;
  export GRASS_OVERWRITE=1&lt;br /&gt;
  v.extract elev_lidrural_mrpts out=elev_lidfirst_pts \&lt;br /&gt;
            where=&amp;quot;return = 1&amp;quot;&lt;br /&gt;
  v.extract elev_lidrural_mrpts out=elev_lidlast_pts  \&lt;br /&gt;
            where=&amp;quot;return &amp;gt;= 2&amp;quot;&lt;br /&gt;
  d.vect elev_lidfirst_pts col=red&lt;br /&gt;
  d.vect elev_lidlast_pts col=green&lt;br /&gt;
&lt;br /&gt;
Outlier detection and separation into two maps&lt;br /&gt;
  # 1st return&lt;br /&gt;
  v.outlier elev_lidfirst_pts output=elev_lidfirst_clean \&lt;br /&gt;
            outlier=elev_lidfirst_outl&lt;br /&gt;
  d.erase&lt;br /&gt;
  d.vect elev_lidfirst_clean siz=2&lt;br /&gt;
  d.vect elev_lidfirst_outl col=red&lt;br /&gt;
&lt;br /&gt;
2nd return&lt;br /&gt;
  v.outlier elev_lidlast_pts output=elev_lidlast_clean \&lt;br /&gt;
            outlier=elev_lidlast_outl&lt;br /&gt;
  d.erase&lt;br /&gt;
  d.vect elev_lidlast_clean siz=2&lt;br /&gt;
  d.vect elev_lidlast_outl col=red&lt;br /&gt;
  # -&amp;gt; no outliers visible&lt;br /&gt;
&lt;br /&gt;
Run an edge detection on cleaned last return:&lt;br /&gt;
  v.lidar.edgedetection elev_lidlast_clean \&lt;br /&gt;
                        out=elev_lidlast_edges&lt;br /&gt;
&lt;br /&gt;
Buildings/vegetation are generated from detected edges (bug: you may need to specify the mapset):&lt;br /&gt;
  v.lidar.growing elev_lidlast_edges@lidar out=elev_lidlast_grow \&lt;br /&gt;
                  first=elev_lidfirst_clean&lt;br /&gt;
&lt;br /&gt;
Compare:&lt;br /&gt;
  d.vect elev_lidlast_pts col=blue&lt;br /&gt;
  d.vect elev_lidlast_grow col=green&lt;br /&gt;
&lt;br /&gt;
Correction (this is applied twice):&lt;br /&gt;
  v.lidar.correction elev_lidlast_grow out=elev_lidlast_corr1 \&lt;br /&gt;
                     terrain=elev_lidlast_terr1&lt;br /&gt;
  v.lidar.correction elev_lidlast_corr1 out=elev_lid_dsm \&lt;br /&gt;
                     terrain=elev_lid_dtm&lt;br /&gt;
&lt;br /&gt;
DEM and DSM are generated:&lt;br /&gt;
  # Estimation of lambda_i parameter with cross validation (watch for RMS!)&lt;br /&gt;
  v.surf.bspline -c elev_lid_dsm sie=100 sin=100&lt;br /&gt;
  v.surf.bspline -c elev_lid_dtm sie=100 sin=100&lt;br /&gt;
  &lt;br /&gt;
  # From the cross-validation, we select lambda with minimal RMS error:&lt;br /&gt;
  # generate raster surfaces at 1m resolution&lt;br /&gt;
  v.surf.bspline elev_lid_dsm raster=lidar_dsm lambda=0.1&lt;br /&gt;
  v.surf.bspline elev_lid_dtm raster=lidar_dtm lambda=0.0001&lt;br /&gt;
  &lt;br /&gt;
  d.rast lidar_dsm&lt;br /&gt;
  d.rast lidar_dtm&lt;br /&gt;
  &lt;br /&gt;
  nviz lidar_dsm,lidar_dtm \&lt;br /&gt;
       col=ortho_2001_t792_1m,ortho_2001_t792_1m&lt;br /&gt;
&lt;br /&gt;
...with the position slider you can visually separate DSM and DEM, increase z slider (Visualize -&amp;gt; Raster Surface -&amp;gt; Position).&lt;br /&gt;
&lt;br /&gt;
== Sample LIDAR data ==&lt;br /&gt;
&lt;br /&gt;
=== Widely used in GRASS tutorials ===&lt;br /&gt;
&lt;br /&gt;
* [http://www.grassbook.org/data_menu2nd.php Jockey's Ridge, NC, LIDAR dataset]&lt;br /&gt;
* [http://www.grassbook.org/data_menu3rd.php North Carolina OSGeo Edu data set] (includes multi-return LIDAR data)&lt;br /&gt;
&lt;br /&gt;
=== Other ===&lt;br /&gt;
&lt;br /&gt;
* United States Antarctic Resource Center: LIDAR High-resolution DEM Final DATA Downloads&amp;lt;BR&amp;gt;http://usarc.usgs.gov/lidar_dload.shtml&lt;br /&gt;
&lt;br /&gt;
* LIDAR ALSM Research, Arizona State University Ative Tectonics, Research Group&amp;lt;BR&amp;gt;  http://lidar.asu.edu/research.html and http://www.geongrid.org/science/lidar.html&lt;br /&gt;
&lt;br /&gt;
* USGS Center for LIDAR Information Coordination and Knowledge (aka CLICK) - USGS LiDAR point cloud distribution site&amp;lt;BR&amp;gt; http://lidar.cr.usgs.gov&lt;br /&gt;
&lt;br /&gt;
* Washington State Geospatial Data Archive, Mount Saint Helens - Lidar Data &amp;lt;BR&amp;gt;https://wagda.lib.washington.edu/data/type/elevation/lidar/st_helens/&lt;br /&gt;
&lt;br /&gt;
* Puget Sound Lidar Consortium, public-domain high-resolution topography for western Washington&amp;lt;BR&amp;gt;http://pugetsoundlidar.ess.washington.edu/index.htm&lt;br /&gt;
&lt;br /&gt;
* NOAA Topographic Change Mapping LIDAR Data Retrieval Tool (LDART) NOAA Coastal Services Center&amp;lt;BR&amp;gt;http://maps.csc.noaa.gov/TCM/&lt;br /&gt;
&lt;br /&gt;
* Landmap, LIDAR Data from the Environment Agency &amp;lt;BR&amp;gt;http://www.landmap.ac.uk/lidar/lidar.html&lt;br /&gt;
&lt;br /&gt;
* Northern California LIDAR data &amp;lt;BR&amp;gt;http://quake.usgs.gov/research/geology/lidar/  and http://core2.gsfc.nasa.gov/lidar/terrapoint/&lt;br /&gt;
&lt;br /&gt;
* IDAHO GEOSPATIAL , Bare Earth LIDAR DEM Download - UTM &amp;lt;BR&amp;gt;http://inside.uidaho.edu/geodata/LiDAR/LiDARBareEarthDEM_DownloadUTM.htm&lt;br /&gt;
&lt;br /&gt;
* EarthScope Spatial Data Explorer - A java application for querying, browsing, and acquiring data from the EarthScope Spatial Data Repository. Currently includes a number of LiDAR datasets. &amp;lt;BR&amp;gt;http://www.earthscope.org/data/lidar.php&lt;br /&gt;
&lt;br /&gt;
* LIDAR Galley &amp;lt;BR&amp;gt;https://peoiewswebinfo.monmouth.army.mil/JPSD/LIDAR_Gallery.htm&lt;br /&gt;
&lt;br /&gt;
* South Tyrol - Download of DTMs (Homepage in German or Italian) &amp;lt;BR&amp;gt; http://www.provinz.bz.it/raumordnung/grundkarten/utm/default_d.htm&lt;br /&gt;
&lt;br /&gt;
== Links ==&lt;br /&gt;
&lt;br /&gt;
* [http://liblas.org/ libLAS] - LAS 1.0/1.1 ASPRS LiDAR data translation toolset&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>⚠️John Tate</name></author>
	</entry>
	<entry>
		<id>https://grasswiki.osgeo.org/w/index.php?title=LIDAR&amp;diff=9857</id>
		<title>LIDAR</title>
		<link rel="alternate" type="text/html" href="https://grasswiki.osgeo.org/w/index.php?title=LIDAR&amp;diff=9857"/>
		<updated>2009-11-03T20:30:46Z</updated>

		<summary type="html">&lt;p&gt;⚠️John Tate: added  using -z flag to lidar point cloud line in general procedure for DEM/DSM complex way&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;h1&amp;gt; LIDAR and Multi-beam Swath bathymetry data &amp;lt;/h1&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Modules ==&lt;br /&gt;
&lt;br /&gt;
=== Import ===&lt;br /&gt;
&lt;br /&gt;
* {{cmd|r.in.xyz}} - Create a raster map from an assemblage of many coordinates using univariate statistics. ([http://hamish.bowman.googlepages.com/grassfiles#xyz example])&lt;br /&gt;
&lt;br /&gt;
* {{cmd|v.in.ascii}} - Import data from an ASCII file to GRASS vector format.&lt;br /&gt;
: ''Due to memory overhead vector point imports will be limited to a few million data points unless topology and database creation is skipped with the '''-bt''' flags''. It may also be useful to clip the import file to only accept points falling within the current region by using the '''-r''' flag. See {{cmd|g.region}} for details on specifying the region bounds.&lt;br /&gt;
&lt;br /&gt;
=== Analysis ===&lt;br /&gt;
&lt;br /&gt;
* {{cmd|v.outlier}} - Removes outliers from vector point data.&lt;br /&gt;
&lt;br /&gt;
* {{cmd|v.lidar.edgedetection}} - Detect the object's edges from a LIDAR data set.&lt;br /&gt;
&lt;br /&gt;
* {{cmd|v.lidar.growing}} - Building contour determination and Region Growing algorithm for determining the building inside.&lt;br /&gt;
&lt;br /&gt;
* {{cmd|v.lidar.correction}} - Correction of the v.lidar.growing output. It is the last of the three algorithms for LIDAR filtering.&lt;br /&gt;
&lt;br /&gt;
=== Surface generation ===&lt;br /&gt;
&lt;br /&gt;
* {{cmd|v.surf.rst}} - Spatial approximation and topographic analysis using regularized spline with tension.&lt;br /&gt;
&lt;br /&gt;
* {{cmd|v.surf.idw}} - Surface interpolation from vector point data by Inverse Distance Squared Weighting.&lt;br /&gt;
&lt;br /&gt;
* {{cmd|v.surf.bspline}} - Surface interpolation from vector point data by bicubic or bilineal interpolation with Tykhonov regularization.&lt;br /&gt;
&lt;br /&gt;
* {{cmd|r.fillnulls}} - Fills no-data areas in raster maps using v.surf.rst splines interpolation.&lt;br /&gt;
&lt;br /&gt;
== Swath Bathymetry Tools ==&lt;br /&gt;
&lt;br /&gt;
''see also the [[Marine_Science#Multibeam_sonar_processing]] wiki page''&lt;br /&gt;
&lt;br /&gt;
* The [http://david.p.finlayson.googlepages.com/swathwidth v.swathwidith] module by David Finlayson for planning surveys. (development page)&lt;br /&gt;
&lt;br /&gt;
* An example of [http://bambi.otago.ac.nz/hamish/grass/gdal/sidescan_warp.html post-processing scanned paper sidescan swaths] using thin plate spline warping with [http://www.gdal.org/ GDAL's] &amp;quot;&amp;lt;tt&amp;gt;gdalwarp -tps&amp;lt;/tt&amp;gt;&amp;quot; function. (debugging page)&lt;br /&gt;
&lt;br /&gt;
* [[Marine_Science#Import_into_GRASS|GRASS integration]] with [http://www.ldeo.columbia.edu/res/pi/MB-System/ MB-System] (GPL) software for processing Multibeam and Sidescan Sonar data. GRASS + MBsys + [[GMT]] make a nice scriptable trio.&lt;br /&gt;
&lt;br /&gt;
== LIDAR Tools ==&lt;br /&gt;
&lt;br /&gt;
*  {{cmd|r.terraflow}} - computation of flow direction, flow accumulation and other basic topographic terrain indices from massive raster digital elevation models (DEM). From the Duke University [http://terrain.cs.duke.edu/ STREAM] project.&lt;br /&gt;
&lt;br /&gt;
* [http://mpa.itc.it/markus/grass61/demos/rlake/ Flood simulation] using {{cmd|r.lake}}. Includes fancy NVIZ visualization of Trento, Italy, by Markus Neteler.&lt;br /&gt;
&lt;br /&gt;
* [http://www.cs.unc.edu/~isenburg/software/ LAStools] are a set of simple command line tools  (including source code) for converting to/from ASCII, viewing, comparing, and compressing LIDAR data.&lt;br /&gt;
&lt;br /&gt;
* [http://www.liblas.org libLAS] ASPRS LiDAR data translation tools&lt;br /&gt;
&lt;br /&gt;
* See also [[LIDAR#Analysis|LIDAR Analysis]]&lt;br /&gt;
&lt;br /&gt;
== Micro-tutorial for LAS data==&lt;br /&gt;
&lt;br /&gt;
=== Preparation ===&lt;br /&gt;
&lt;br /&gt;
==== Conversion of text files to LAS ====&lt;br /&gt;
&lt;br /&gt;
[http://www.liblas.org/ libLAS] supports the following column types:&lt;br /&gt;
   x - x coordinate&lt;br /&gt;
   y - y coordinate&lt;br /&gt;
   z - z coordinate&lt;br /&gt;
   a - scan angle&lt;br /&gt;
   i - intensity&lt;br /&gt;
   n - number of returns for given pulse (1..n)&lt;br /&gt;
   r - number of this return (1..r)&lt;br /&gt;
   c - classification&lt;br /&gt;
   u - user data (but only 1 byte)&lt;br /&gt;
   p - point source ID&lt;br /&gt;
   e - edge of flight line&lt;br /&gt;
   d - direction of scan flag&lt;br /&gt;
   t - GPS time&lt;br /&gt;
   s - skip column&lt;br /&gt;
&lt;br /&gt;
Sample text data such as:&lt;br /&gt;
   returntime,pulse,east,north,height,intensity,stripe&lt;br /&gt;
   549778.907200,1,673999.940,5099680.080,507.425,20.0,45105&lt;br /&gt;
   ...&lt;br /&gt;
&lt;br /&gt;
can be converted to LAS format like this:&lt;br /&gt;
   returntime - t&lt;br /&gt;
   pulse - r&lt;br /&gt;
   east - x&lt;br /&gt;
   north - y&lt;br /&gt;
   height - z&lt;br /&gt;
   intensity - i&lt;br /&gt;
   stripe - s&lt;br /&gt;
&lt;br /&gt;
First parse (sanity check):&lt;br /&gt;
   txt2las -parse trxyzis data.asc&lt;br /&gt;
&lt;br /&gt;
Then convert:&lt;br /&gt;
   txt2las -parse trxyzis -i data.asc -o data.las &lt;br /&gt;
&lt;br /&gt;
While you may not need to do this conversion for GRASS import, the resulting files are way smaller than the uncompressed text files; additionally, they are in a defined format.&lt;br /&gt;
&lt;br /&gt;
=== LAS Import ===&lt;br /&gt;
&lt;br /&gt;
* Use the [http://www.liblas.org libLAS] utilities to import LAS data into GRASS. &lt;br /&gt;
* Data stored in text files can generally be imported directly into GRASS.&lt;br /&gt;
&lt;br /&gt;
* The data used in the rest of this micro-tutorial can be found at [http://www.appliedimagery.com/Serpent%20Mound%20Model%20LAS%20Data.las appliedimagery.com].&lt;br /&gt;
&lt;br /&gt;
==== Import LAS as raster DEM ====&lt;br /&gt;
&lt;br /&gt;
Check bounds and SRS:&lt;br /&gt;
 $ lasinfo &amp;quot;Serpent_Mound_Model_LAS_Data.las&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
  [...]&lt;br /&gt;
  Min X Y Z                  289020.900000 4320942.610000 166.780000&lt;br /&gt;
  Max X Y Z                  290106.020000 4323641.570000 215.480000&lt;br /&gt;
 Spatial Reference           +proj=utm +zone=17 +ellps=WGS84 +units=m &lt;br /&gt;
&lt;br /&gt;
After creating a suitable UTM zone 17 location (EPSG:32617) &lt;br /&gt;
set the region according to the information from lasinfo at 1m resolution, rounding grid outwards to align to whole meters:&lt;br /&gt;
 GRASS&amp;gt; {{cmd|g.region}} n=4323641.57 s=4320942.61 w=289020.90 e=290106.02 res=1 -ap&lt;br /&gt;
&lt;br /&gt;
Finally, import with {{cmd|r.in.xyz}} with data piped directly from the &amp;lt;tt&amp;gt;las2txt&amp;lt;/tt&amp;gt; program and set a nice equalized color table:&lt;br /&gt;
 BASEMAP=&amp;quot;Serpent_Mound_Model_LAS&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 las2txt --stdout &amp;quot;${BASEMAP}_Data.las&amp;quot; | \&lt;br /&gt;
    r.in.xyz in=- out=${BASEMAP}_Data fs=space method=mean&lt;br /&gt;
 &lt;br /&gt;
 {{cmd|r.colors}} ${BASEMAP}_Data color=bcyr -e&lt;br /&gt;
&lt;br /&gt;
The above example uses the default z-elevation level as the 3rd term, but by using the &amp;lt;tt&amp;gt;las2txt --parse&amp;lt;/tt&amp;gt; command other fields (such as intensity) can be imported instead via &amp;quot;&amp;lt;tt&amp;gt;--parse xyi&amp;lt;/tt&amp;gt;&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
==== Import LAS as vector points ====&lt;br /&gt;
&lt;br /&gt;
Region setting (establishing the grid) is not needed for vector features so we can go directly to the import step. To deal with millions of input points {{cmd|v.in.ascii}} should be run with the options to skip creation of an attribute database and building topology as these can consume large amounts of memory. Note that vector maps without topology built are somewhat limited in their ability to be processed. Most LIDAR specific modules have been adapted to not require &lt;br /&gt;
topology. Even so, after initial cleaning steps it is often more efficient to work with huge datasets in GRASS as raster data.&lt;br /&gt;
&lt;br /&gt;
 las2txt --stdout &amp;quot;${BASEMAP}_Data.las&amp;quot; | \&lt;br /&gt;
   v.in.ascii -tbz z=3 out=&amp;quot;${BASEMAP}_pts&amp;quot; fs=space&lt;br /&gt;
&lt;br /&gt;
If topology was built, you can use {{cmd|d.vect}}'s -z flag to colorize by elevation value. Without topology you can still colorize, but you need to use color rules based on absolute elevations, not percentage of scale.&lt;br /&gt;
&amp;lt;!-- need an absolute color map gradiated across the elev range --&amp;gt;&lt;br /&gt;
 # display colorized points for data with built topology&lt;br /&gt;
 d.vect map=lidar_pts size=1 -z zcolor=elevation&lt;br /&gt;
&lt;br /&gt;
* After import as points you can then use the v.lidar tools to clean the data: {{cmd|v.lidar.correction}}, {{cmd|v.lidar.edgedetection}}, {{cmd|v.lidar.growing}}, and {{cmd|v.outlier}}.&lt;br /&gt;
&lt;br /&gt;
* Vector points can be interpolated into raster DEMs with a number of modules, including {{cmd|v.surf.rst}}, {{cmd|v.surf.bspline}}, and {{cmd|v.surf.idw}}.&lt;br /&gt;
&lt;br /&gt;
=== Clean imported raster DEM ===&lt;br /&gt;
&lt;br /&gt;
(fill holes)&lt;br /&gt;
&lt;br /&gt;
 # convert to vector points&lt;br /&gt;
 r.to.vect -z feature=point in=${BASEMAP}_Data out=${BASEMAP}_pt&lt;br /&gt;
 &lt;br /&gt;
 # interpolate using a regularized spline fit&lt;br /&gt;
 # this is very slow, but produces very high quality output&lt;br /&gt;
 v.surf.rst layer=0 in=${BASEMAP}_pt elev=${BASEMAP}.rst&lt;br /&gt;
 &lt;br /&gt;
 # create 5m buffer area around original data points&lt;br /&gt;
 r.buffer in=${BASEMAP}_Data out=${BASEMAP}.5m_buff dist=5&lt;br /&gt;
 &lt;br /&gt;
 # crop interpolated DEM to only include areas nearby actual data&lt;br /&gt;
 r.mapcalc &amp;quot;${BASEMAP}.filled = \&lt;br /&gt;
    if( isnull(${BASEMAP}.5m_buff), null(), ${BASEMAP}.rst)&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 # set colors to something nice&lt;br /&gt;
 r.colors ${BASEMAP}.filled color=bcyr -e&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Depending on your needs, {{cmd|r.fillnulls}}, {{cmd|v.surf.bspline}}, {{cmd|v.surf.idw}}, {{cmd|r.surf.idw}}, {{cmd|r.surf.idw2}}, or [[GRASS_AddOns#r.surf.nnbathy|r.surf.nnbathy]] may be faster than the {{cmd|v.surf.rst}} method.&lt;br /&gt;
&lt;br /&gt;
=== Visualize raster DEM in 3D ===&lt;br /&gt;
&lt;br /&gt;
 nviz ${BASEMAP}.filled&lt;br /&gt;
&lt;br /&gt;
* Set z-exag to 2.0&lt;br /&gt;
* In Visualize &amp;amp;rarr; Raster Surfaces set the fine (final) resolution to 1, and coarse (preview) resolution to 5.&lt;br /&gt;
* Set the height to 500.0, the perspective to 15.0, and drag the view-puck to the North-West and reasonably zoomed in.&lt;br /&gt;
: You should now be able to see the serpent:&lt;br /&gt;
&lt;br /&gt;
[[Image:LAS_serpent_nviz.jpg|thumb|center|400px|The Great Serpent Mound, Adams County, Ohio, USA]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
It is possible to show vector points in 3D, but millions of them may make the program run slow. Topology is required ({{cmd|v.build}}). Tick the &amp;quot;3D&amp;quot; box in the Visualize &amp;amp;rarr; Vector points dialog.&lt;br /&gt;
&lt;br /&gt;
=== LAS Export ===&lt;br /&gt;
&lt;br /&gt;
==== Export to LAS ====&lt;br /&gt;
&lt;br /&gt;
This is the reverse of the import step, but using {{cmd|v.out.ascii}} or {{cmd|r.out.xyz}} with ''txt2las''.&lt;br /&gt;
Because the v.out.ascii module exports category number which we are not interested in, we cut it away with the UNIX ''cut'' utility.&lt;br /&gt;
&lt;br /&gt;
 v.out.ascii ${BASEMAP}_pts fs=space | cut -f1-3 -d' ' \&lt;br /&gt;
     &amp;gt; ${BASEMAP}_export.txt&lt;br /&gt;
 &lt;br /&gt;
 txt2las --parse xyz -i ${BASEMAP}_export.txt&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Micro-tutorial for LIDAR data analysis ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Simple analysis of single return data ===&lt;br /&gt;
&lt;br /&gt;
Data source: North Carolina sample data set (Lidar data from 2001, near Raleigh, North Carolina). Download from&lt;br /&gt;
   http://www.grassbook.org/ncexternal/&lt;br /&gt;
   -&amp;gt; File: BE3720079200WC20020829m.txt 3.6M (lidar bare earth points [spm])&lt;br /&gt;
&lt;br /&gt;
Scan input file for spatial extent. The -g flag shows the result in a convenient copy-paste format for {{cmd|g.region}}:&lt;br /&gt;
   r.in.xyz BE3720079200WC20020829m.txt out=dummy -s -g&lt;br /&gt;
&lt;br /&gt;
We use this output to set region, predefine 2m raster cells, and polish the odd coordinates with -a:&lt;br /&gt;
   g.region n=222504.439000 s=219456.442000 e=640081.274000 w=637033.274000 res=2 -a -p&lt;br /&gt;
&lt;br /&gt;
==== QUESTION 1: Are these Lidar data sufficiently dense? ====&lt;br /&gt;
&lt;br /&gt;
We compute a raster map representing number of points per cell&lt;br /&gt;
   r.in.xyz BE3720079200WC20020829m.txt out=lid_792_binn2m method=n&lt;br /&gt;
&lt;br /&gt;
Look at the resulting raster map:&lt;br /&gt;
   d.mon x0&lt;br /&gt;
   d.font Vera&lt;br /&gt;
   d.rast.leg lid_792_binn2m&lt;br /&gt;
&lt;br /&gt;
Report point distribution in percent:&lt;br /&gt;
   r.report lid_792_binn2m unit=p&lt;br /&gt;
&lt;br /&gt;
Reduce the resolution to 6m to get at least one point per cell:&lt;br /&gt;
   g.region res=6 -a -p&lt;br /&gt;
   r.in.xyz BE3720079200WC20020829m.txt out=lid_792_binn6m method=n&lt;br /&gt;
   d.rast.leg lid_792_binn6m&lt;br /&gt;
   # ... a few holes remain but that's probably acceptable.&lt;br /&gt;
&lt;br /&gt;
Compute raster maps representing mean elevation for each cell:&lt;br /&gt;
   r.in.xyz BE3720079200WC20020829m.txt out=lid_792_binmean6m  \&lt;br /&gt;
            meth=mean&lt;br /&gt;
   d.rast.leg lid_792_binmean6m&lt;br /&gt;
&lt;br /&gt;
Compute range and variation:&lt;br /&gt;
   r.in.xyz BE3720079200WC20020829m.txt out=lid_792_binrange6m \&lt;br /&gt;
            meth=range&lt;br /&gt;
   d.rast.leg lid_792_binrange6m&lt;br /&gt;
   r.in.xyz BE3720079200WC20020829m.txt out=lid_792_binvar6m   \&lt;br /&gt;
            meth=coeff_var&lt;br /&gt;
   d.rast.leg lid_792_binvar6m&lt;br /&gt;
&lt;br /&gt;
Overlay other GIS maps to map of mean elevation:&lt;br /&gt;
   d.rast.leg lid_792_binmean6m&lt;br /&gt;
   d.vect streets_wake&lt;br /&gt;
   d.vect lakes type=boundary&lt;br /&gt;
   d.vect streams&lt;br /&gt;
&lt;br /&gt;
Now we continue to work in a zoomed spatial subset of the area.&lt;br /&gt;
&lt;br /&gt;
We import only points in the rural area without building topology and using z-coordinate for elevation:&lt;br /&gt;
   g.region rural_1m -p&lt;br /&gt;
   v.in.ascii -ztbr BE3720079200WC20020829m.txt \&lt;br /&gt;
              out=elev_lidrural_bepts z=3&lt;br /&gt;
&lt;br /&gt;
Clear monitor show black-white orthophoto:&lt;br /&gt;
   d.erase -f&lt;br /&gt;
   d.rast ortho_2001_t792_1m&lt;br /&gt;
&lt;br /&gt;
We now use already prepared Lidar vector point maps:&lt;br /&gt;
* elev_lid792_bepts:   Rural area (in tile 792), bare earth lidar point cloud&lt;br /&gt;
* elev_lidrural_mrpts: Rural area multiple return lidar point cloud&lt;br /&gt;
&lt;br /&gt;
Look at ground data:&lt;br /&gt;
d.vect elev_lidrural_bepts siz=2 col=red&lt;br /&gt;
&lt;br /&gt;
Look at &amp;quot;surface&amp;quot; data:&lt;br /&gt;
d.vect elev_lidrural_mrpts siz=1 col=green&lt;br /&gt;
&lt;br /&gt;
Visualize 3D Lidar multi-return points:&lt;br /&gt;
nviz elev_lid792_1m point=elev_lidrural_mrpts&lt;br /&gt;
 # Visualize -&amp;gt; Vector Points -&amp;gt; 3D points&lt;br /&gt;
 #                            -&amp;gt; Icon size 2.25&lt;br /&gt;
 #  --&amp;gt; GRASS book p. 253, fig. 3.15 (see also screenshot [http://www.grassbook.org/about_menu3rd.php here])&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== DEM/DSM separation the simple way by selection of Lidar returns ====&lt;br /&gt;
&lt;br /&gt;
Find out where we have multiple returns:&lt;br /&gt;
   d.rast ortho_2001_t792_1m&lt;br /&gt;
   d.vect elev_lidrural_mrpts where=&amp;quot;return=1&amp;quot; col=red siz=2&lt;br /&gt;
   d.vect elev_lidrural_mrpts where=&amp;quot;return=2&amp;quot; col=green siz=3&lt;br /&gt;
   d.vect elev_lidrural_mrpts where=&amp;quot;return=3&amp;quot; col=blue&lt;br /&gt;
   d.vect elev_lidrural_mrpts where=&amp;quot;return=4&amp;quot; col=yellow&lt;br /&gt;
&lt;br /&gt;
DTM: extract last return(s):&lt;br /&gt;
   v.extract elev_lidrural_mrpts out=elev_lidrural_mrpts_first where=&amp;quot;Return &amp;lt; 2&amp;quot;&lt;br /&gt;
   nviz elev_lid792_1m point=elev_lidrural_mrpts_first&lt;br /&gt;
&lt;br /&gt;
Interpolate to map and look at it:&lt;br /&gt;
   v.surf.rst elev_lidrural_mrpts_first layer=0 elev=elev_lidrural_mrpts_DTM&lt;br /&gt;
   nviz elev_lidrural_mrpts_DTM col=ortho_2001_t792_1m&lt;br /&gt;
&lt;br /&gt;
DSM: extract first return(s):&lt;br /&gt;
   v.extract elev_lidrural_mrpts out=elev_lidrural_mrpts_last where=&amp;quot;Return &amp;gt; 2&amp;quot;&lt;br /&gt;
   nviz elev_lid792_1m point=elev_lidrural_mrpts_last&lt;br /&gt;
&lt;br /&gt;
Interpolate to map and look at it:&lt;br /&gt;
   v.surf.rst elev_lidrural_mrpts_first layer=0 elev=elev_lidrural_mrpts_DSM&lt;br /&gt;
   nviz elev_lidrural_mrpts_DSM col=ortho_2001_t792_1m&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== DEM/DSM separation the more complex way ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;''TODO: verify order of first and last returns in below text''&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
General procedure:&lt;br /&gt;
* Lidar point clouds (first and last return) are imported with {{cmd|v.in.ascii}} (-b flag to not build the topology, and -z flag to create 3D vector map).&lt;br /&gt;
* Outlier detection is done with {{cmd|v.outlier}} on both first and last return data.&lt;br /&gt;
* Then, with {{cmd|v.lidar.edgedetection}}, edges are detected from last return data.&lt;br /&gt;
* The building are generated by {{cmd|v.lidar.growing}} from detected edges.&lt;br /&gt;
* The resulting data are post-processed with {{cmd|v.lidar.correction}}.&lt;br /&gt;
* Finally, the DTM and DSM are generated with {{cmd|v.surf.bspline}} (DTM: uses the 'v.lidar.correction' output; DSM: uses last return output from outlier detection).&lt;br /&gt;
&lt;br /&gt;
  export GRASS_OVERWRITE=1&lt;br /&gt;
  v.extract elev_lidrural_mrpts out=elev_lidfirst_pts \&lt;br /&gt;
            where=&amp;quot;return = 1&amp;quot;&lt;br /&gt;
  v.extract elev_lidrural_mrpts out=elev_lidlast_pts  \&lt;br /&gt;
            where=&amp;quot;return &amp;gt;= 2&amp;quot;&lt;br /&gt;
  d.vect elev_lidfirst_pts col=red&lt;br /&gt;
  d.vect elev_lidlast_pts col=green&lt;br /&gt;
&lt;br /&gt;
Outlier detection and separation into two maps&lt;br /&gt;
  # 1st return&lt;br /&gt;
  v.outlier elev_lidfirst_pts output=elev_lidfirst_clean \&lt;br /&gt;
            outlier=elev_lidfirst_outl&lt;br /&gt;
  d.erase&lt;br /&gt;
  d.vect elev_lidfirst_clean siz=2&lt;br /&gt;
  d.vect elev_lidfirst_outl col=red&lt;br /&gt;
&lt;br /&gt;
2nd return&lt;br /&gt;
  v.outlier elev_lidlast_pts output=elev_lidlast_clean \&lt;br /&gt;
            outlier=elev_lidlast_outl&lt;br /&gt;
  d.erase&lt;br /&gt;
  d.vect elev_lidlast_clean siz=2&lt;br /&gt;
  d.vect elev_lidlast_outl col=red&lt;br /&gt;
  # -&amp;gt; no outliers visible&lt;br /&gt;
&lt;br /&gt;
Run an edge detection on cleaned last return:&lt;br /&gt;
  v.lidar.edgedetection elev_lidlast_clean \&lt;br /&gt;
                        out=elev_lidlast_edges&lt;br /&gt;
&lt;br /&gt;
Buildings/vegetation are generated from detected edges (bug: you may need to specify the mapset):&lt;br /&gt;
  v.lidar.growing elev_lidlast_edges@lidar out=elev_lidlast_grow \&lt;br /&gt;
                  first=elev_lidfirst_clean&lt;br /&gt;
&lt;br /&gt;
Compare:&lt;br /&gt;
  d.vect elev_lidlast_pts col=blue&lt;br /&gt;
  d.vect elev_lidlast_grow col=green&lt;br /&gt;
&lt;br /&gt;
Correction (this is applied twice):&lt;br /&gt;
  v.lidar.correction elev_lidlast_grow out=elev_lidlast_corr1 \&lt;br /&gt;
                     terrain=elev_lidlast_terr1&lt;br /&gt;
  v.lidar.correction elev_lidlast_corr1 out=elev_lid_dsm \&lt;br /&gt;
                     terrain=elev_lid_dtm&lt;br /&gt;
&lt;br /&gt;
DEM and DSM are generated:&lt;br /&gt;
  # Estimation of lambda_i parameter with cross validation (watch for RMS!)&lt;br /&gt;
  v.surf.bspline -c elev_lid_dsm sie=100 sin=100&lt;br /&gt;
  v.surf.bspline -c elev_lid_dtm sie=100 sin=100&lt;br /&gt;
  &lt;br /&gt;
  # From the cross-validation, we select lambda with minimal RMS error:&lt;br /&gt;
  # generate raster surfaces at 1m resolution&lt;br /&gt;
  v.surf.bspline elev_lid_dsm raster=lidar_dsm lambda=0.1&lt;br /&gt;
  v.surf.bspline elev_lid_dtm raster=lidar_dtm lambda=0.0001&lt;br /&gt;
  &lt;br /&gt;
  d.rast lidar_dsm&lt;br /&gt;
  d.rast lidar_dtm&lt;br /&gt;
  &lt;br /&gt;
  nviz lidar_dsm,lidar_dtm \&lt;br /&gt;
       col=ortho_2001_t792_1m,ortho_2001_t792_1m&lt;br /&gt;
&lt;br /&gt;
...with the position slider you can visually separate DSM and DEM, increase z slider (Visualize -&amp;gt; Raster Surface -&amp;gt; Position).&lt;br /&gt;
&lt;br /&gt;
== Sample LIDAR data ==&lt;br /&gt;
&lt;br /&gt;
=== Widely used in GRASS tutorials ===&lt;br /&gt;
&lt;br /&gt;
* [http://www.grassbook.org/data_menu2nd.php Jockey's Ridge, NC, LIDAR dataset]&lt;br /&gt;
* [http://www.grassbook.org/data_menu3rd.php North Carolina OSGeo Edu data set] (includes multi-return LIDAR data)&lt;br /&gt;
&lt;br /&gt;
=== Other ===&lt;br /&gt;
&lt;br /&gt;
* United States Antarctic Resource Center: LIDAR High-resolution DEM Final DATA Downloads&amp;lt;BR&amp;gt;http://usarc.usgs.gov/lidar_dload.shtml&lt;br /&gt;
&lt;br /&gt;
* LIDAR ALSM Research, Arizona State University Ative Tectonics, Research Group&amp;lt;BR&amp;gt;  http://lidar.asu.edu/research.html and http://www.geongrid.org/science/lidar.html&lt;br /&gt;
&lt;br /&gt;
* USGS Center for LIDAR Information Coordination and Knowledge (aka CLICK) - USGS LiDAR point cloud distribution site&amp;lt;BR&amp;gt; http://lidar.cr.usgs.gov&lt;br /&gt;
&lt;br /&gt;
* Washington State Geospatial Data Archive, Mount Saint Helens - Lidar Data &amp;lt;BR&amp;gt;https://wagda.lib.washington.edu/data/type/elevation/lidar/st_helens/&lt;br /&gt;
&lt;br /&gt;
* Puget Sound Lidar Consortium, public-domain high-resolution topography for western Washington&amp;lt;BR&amp;gt;http://pugetsoundlidar.ess.washington.edu/index.htm&lt;br /&gt;
&lt;br /&gt;
* NOAA Topographic Change Mapping LIDAR Data Retrieval Tool (LDART) NOAA Coastal Services Center&amp;lt;BR&amp;gt;http://maps.csc.noaa.gov/TCM/&lt;br /&gt;
&lt;br /&gt;
* Landmap, LIDAR Data from the Environment Agency &amp;lt;BR&amp;gt;http://www.landmap.ac.uk/lidar/lidar.html&lt;br /&gt;
&lt;br /&gt;
* Northern California LIDAR data &amp;lt;BR&amp;gt;http://quake.usgs.gov/research/geology/lidar/  and http://core2.gsfc.nasa.gov/lidar/terrapoint/&lt;br /&gt;
&lt;br /&gt;
* IDAHO GEOSPATIAL , Bare Earth LIDAR DEM Download - UTM &amp;lt;BR&amp;gt;http://inside.uidaho.edu/geodata/LiDAR/LiDARBareEarthDEM_DownloadUTM.htm&lt;br /&gt;
&lt;br /&gt;
* EarthScope Spatial Data Explorer - A java application for querying, browsing, and acquiring data from the EarthScope Spatial Data Repository. Currently includes a number of LiDAR datasets. &amp;lt;BR&amp;gt;http://www.earthscope.org/data/lidar.php&lt;br /&gt;
&lt;br /&gt;
* LIDAR Galley &amp;lt;BR&amp;gt;https://peoiewswebinfo.monmouth.army.mil/JPSD/LIDAR_Gallery.htm&lt;br /&gt;
&lt;br /&gt;
* South Tyrol - Download of DTMs (Homepage in German or Italian) &amp;lt;BR&amp;gt; http://www.provinz.bz.it/raumordnung/grundkarten/utm/default_d.htm&lt;br /&gt;
&lt;br /&gt;
== Links ==&lt;br /&gt;
&lt;br /&gt;
* [http://liblas.org/ libLAS] - LAS 1.0/1.1 ASPRS LiDAR data translation toolset&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>⚠️John Tate</name></author>
	</entry>
</feed>