LAS File Processing Using LASTOOLS
LAS File Processing Using LASTOOLS
LAS File Processing Using LASTOOLS
LASTOOLS is a set of individual command line tools that process data stored in LAS format.
Written by Martin Isenburg, these tools are an efficient way to perform an assortment of
conversion, reformatting and data inspection workflows. This document presents a variety of
examples and scenarios that show how you can use LASTOOLS to work with the LAS files you
download from the Minnesota Geospatial Information Office ftp site at:
ftp://ftp.lmic.state.mn.us/pub/data/elevation/lidar.
Contents
Prelude .......................................................................................................................................................... 2
GETTING STARTED......................................................................................................................................... 3
WORKING WITH MINNESOTA LAS/LAZ DATA ............................................................................................... 5
LISTING THE PROPERTIES OF A LAS/LAZ FILE ................................................................................................ 6
EXPORTING LAS/LAZ FILES TO ASCII X,Y,Z FORMATTED FILES ...................................................................... 7
SUBSETTING (CLIPPING) LAS/LAZ Files.......................................................................................................... 7
MERGING TILES of LAS/LAZ FILES.................................................................................................................. 9
PROJECTING LAS/LAZ FILES TO COUNTY COORDINATES .............................................................................. 9
SCALING X, Y AND Z COORDINATES TO FEET (but not changing the projection) ....................................... 11
USING CURL WITH LASTOOLS. An alternative to downloading data .......................................................... 12
I want to start off by stating very clearly that I DON’T USE AutoCAD, I’m an ArcMAP monkey. But I have
worked with quite a few really great folks who use CAD over the past two years in an effort to help them
get LiDAR data into AutoCAD effectively. What I’m presenting below is based on those experiences.
There may be better ways to do this and I would be grateful to know what they are. So, if you’re reading
this thinking…”he doesn’t know what he’s talking about” I hope you get back to me and set me straight!
What I have seen in my experience working with CAD techs is that they are most interested in laser
shots that have bounced off the ground and not a tree or a building. LiDAR data is a collection of point
data and these points are categorized (classified) and assigned a number that represents what they
bounced off of. The LiDAR point classifications as defined in the ASPRS LAS Standards are:
Not all LAS files are categorized to the full extent of this set of classifications. In many cases there are
only class 2 and 1. In others there are more. It just depends on the purpose of the LiDAR flight and what
was contracted to be done by the vendor. For the data in your county we’ve got classes 1, 2, 4 (all
vegetation), 6, 7, 8, 9, 10, and 12.
The categories most important to those individuals that are using CAD or GIS software to model the
ground should be most interested in categories 2 (ground) and 8 (model key-point). Model Key-Points
represent a subset of the Ground points that have been filtered to identify those points that are
required to build a surface capable of producing two foot contours. You’ll lose some detail for sure by
weeding out these points, but the contours created are “statistically” valid at the 95% confidence level.
There are so many ground points that many CAD systems have a tough time dealing with points over a
moderately sized area but it varies a lot because folks have different versions of the software and
hardware with different capabilities. The latest versions of AutoCAD have been tweaked to be able to
The following sections describe a variety of LiDAR Use Cases that I have seen. I’m adding to this
document on a regular basis as new Use Cases surface.
I hope you find this information useful and I appreciate any feedback that you might have on making this
document more useful.
GETTING STARTED
LASTOOLS is a set of command line tools that perform a wide variety of processing methods on LAS
formatted files.
ONLY PORTIONS OF THESE TOOLS ARE AVAILABLE FOR FREE. PLEASE READ THE LICENSING
DOCUMENTS. ALL OF THE TOOLS REFERENCED IN THIS DOCUMENT ARE AVAILABLE TO USE
FOR FREE. (LASINFO, LASZIP, LAS2LAS, LAS2TXT).
Please consult the link http://lastools.org/download/LICENSE.txt for a listing of the tools and
their licensing requirements.
Each tool can be downloaded individually or they can be downloaded as an entire set in a zip
file. There is no installation routine, if you are using Windows you simply unzip the files to a
folder on your hard drive, open a command window and run the commands.
I suggest that you unzip LASTOOLS to your C:\ drive and don’t put in a folder that has a space in
the name. Simply taking the default and unzipping to the C:\ folder will result in a folder named
“C:\LASTOOLS” and make sure you retain the folders that are included in the zip file. Unzipping
will create a number of folders in this directory. All of the executable programs are stored in a
folder named “c:\lastools\bin”.
It’s helpful to add the BIN folder to your system PATH environment variable (c:\lastools\bin).
Consult your windows documentation on how to access and modify environment variables.
Once you add the folder to your path statement you can call the programs that exist in this
folder by name and don’t have to enter the entire path to run them.
CURL
CURL is an Open Source tool (http://curl.haxx.se/) that provides the capability to download resources
from URL and FTP based sources. This tool provides the capacity to download data from the internet
and feed the files into processing software. Like LASTOOLS, CURL is a command line tool that is run via a
system Command Prompt.
What does this mean for LASTOOLS? This means that you can remove the download step and use
LASTOOLS to process files as they are being retrieved by CURL. Instead of specifying a file to process you
use the –stdin switch in LASTOOLS to process the data stream coming in from the standard input. When
used in conjunction with CURL you can download and process all at the same time.
This functionality is a time and disk-space saver because it can "hide" the time required for compression
or decompression of LAS/LAZ by doing it simultaneously while the file is downloading and avoid having
to store a compressed (or uncompressed) copy.
All LASTOOLS functions and switches can utilize this technique and most of the examples listed below
will include a CURL example.
NOTE: I’ve got one LAZ file named 4310-07-50.laz stored in a folder named D:\dems
b. I have my data stored in a folder called D:\DEMS. So, the first thing I’m going to
do is change directories using the CD DEMs command
D:\> cd \dems
c. To unzip the LAZ file I’ll use the LASZIP command and the wildcard to unzip all of
the files in this folder even though I have only one. This will unzip the LAZ file
and create a LAS file with the same name as shown below.
d. This will unzip all of the LAZ files in the folder (-i *.laz) and display all messages (-
v).
Notice for this LAZ file the following classifications and point numbers:
Using CURL :
Let’s assume that we want to get bare-earth points from a LAS file into a text file that has the X
Y and Z values in that order separated by commas. Bare earth points have classification value
#2 and there is also a Mass Point class that is a reduced set of points that is classification #8.
In this example we’ll create two outputs, one with classifications 2 and 8 and one with only
class 8.
Start by creating the output file with all of the bare earth points using the following command:
Based on the histogram of points listed above, there should be 5,113,094 + 186,192 = 5,299,286
points in the output file.
Next we’ll create an output file that has just the Mass Points in them. This output will contain
many fewer points than the first one. Use the command line:
Based on the histogram of points listed above, there should be 186,192 points in the output
file.
Curl Example
-CLIP_CIRCLE x y radius
-CLIP Min_x Min_y Max_x Max_y
Clipping on an extent
LAS2TXT –i 4310-07-50.LAZ –o 4310-07-50_MP.TXT –parse xyz –sep comma –keep_class 8 –CLIP
345465 4889562 346135 4890188
Clipping on a circle
LAS2TXT –i 4310-07-50.LAZ –o 4310-07-50_MP.TXT –parse xyz –sep comma –keep_class 8 –clip_circle
345465 4889562 500
CURL Examples:
Clipping on an extent
CURL –s ftp://ftp.lmic.state.mn.us/pub/data/elevation/lidar/county/yellowmedicine/laz/4310-07-
50.laz | LAS2TXT–stdin –o 4310-07-50_MP.TXT –parse xyz –sep comma –keep_class 8 –clip 345465
4889562 346135 4890188
Clipping on a circle
CURL –s ftp:// ftp.lmic.state.mn.us/pub/data/elevation/lidar /county/yellowmedicine/laz/4310-07-
50.laz | LAS2TXT–stdin -o 4310-07-50_MP.TXT -parse xyz –sep comma –keep_class 8 clip_circle
345465 4889562 500
Well – LASTOOLS has a switch for that too. It’s the –merged switch. Let’s say you’ve found that
your project area is in two tiles and you’ve downloaded those two LAZ files to your working
folder. You can convert them to comma separated files (-sep comma), xyz order (-parse xyz)
filtering out the mass points (-keep_class 8) and clipping if you want to (–clip minx miny maxx
maxy). The way to get this done is to use the wildcard “*” sign.
This will output a single comma separated file that contains all of the mass points from all the
LAZ files found in the folder.
LAS2TXT –i *.LAZ –o OUTPUT.CSV –parse xyz –sep comma –keep_class 8 –clip_circle 345465
4889562 1500 –merged
Fortunately, LASTOOLS can handle this as well using the LAS2LAS tool. This tool has the
capability to perform a wide variety of processing tasks on LAS/LAZ files with LAS/LAZ being the
output.
In this example, we’ll use LAS2LAS to project a LAZ file from UTM to Brown County Coordinates.
There is a bit of information that you have to know prior to doing this projection. For Brown
county the parameters are as follows:
To project all of the points in the LAS file use the following command:
To project only the bare earth and mass points use the following command:
To project all the LAS files in the folder to LAS files use the following command:
D:\> las2las –i *.laz –o *.las meter -target_lcc 500000 100000 feet 44.108055555555559 -
94.733333333333334 44.166666666666657 44.466666666666669
-target_feet -target_elevation_feet
For a complete listing of the various county coordinate systems in the state refer to the MnDOT
web site at: http://www.dot.state.mn.us/surveying/ToolsTech/mapproj.html
-scale_x <scale_factor>
-scale_y <scale_factor>
-scale_z <scale_factor>
An example of where you might use this is when converting from a LAS/LAZ file to an ASCII
(text) file in X,Y,Z format. Let’s expand on the example listed earlier.
Will create a file called 4310-07-05_BE.TXT that contains only points with a classification of 8
formatted in the order xyz and separated by commas. To scale the X, Y, and Z values we would
add the following:
Using CURL
CURL –s ftp://ftp.lmic.state.mn.us/pub/data/elevation/lidar/county/yellowmedicine/laz/4310-07-
50.laz | LAS2TXT –stdin –o 4310-07-50_BE.TXT –parse xyz –sep comma –keep_class 2 8 –scale_x
3.28083 –scale_y 3.28083 –scale_z 3.280823
CURL is an Open Source tool (http://curl.haxx.se/) that provides the capability to download resources
from URL and FTP based sources. This tool provides the capacity to download data from the internet
and feed the files into processing software. Like LASTOOLS, CURL is a command line tool that is run via a
system Command Prompt.
What does this mean for LASTOOLS? This means that you can remove the download step and use
LASTOOLS to process files as they are being retrieved by CURL. Instead of specifying a file to process you
use the –stdin switch in LASTOOLS to process the data stream coming in from the standard input. When
used in conjunction with CURL you can download and process all at the same time.
Going back to the example used previously to create an ASCII file of X,Y,Z values we used the command
line:
This assumes that we have previously downloaded the LAZ file 4310-07-50.LAZ from
ftp://ftp.lmic.state.mn.us/pub/data/elevation/lidar/county/yellowmedicine/laz
Using CURL we can download and process at the same time. So the above command turns into:
CURL –s ftp://ftp.lmic.state.mn.us/pub/data/elevation/lidar/county/yellowmedicine/laz/4310-07-
50.laz | LAS2TXT–stdin -o 4310-07-50_MP.TXT -parse xyz –sep comma –keep_class 8
What happens here is that CURL finds the file on the internet address, downloads the file to the
standard input, then pipes the input stream to LASTOOLS which is directed to get the data from the
standard input (-stdin).
You can also use this same technique to get a listing of the LAZ file contents using LASINFO in the
following way:
CURL –s ftp://ftp.lmic.state.mn.us/pub/data/elevation/lidar/county/yellowmedicine/laz/4310-07-
50.laz | LASINFO –stdin
This functionality is a time and disk-space saver because it can "hide" the time required for compression
or decompression of LAS/LAZ by doing it simultaneously while the file is downloading and avoid having
to store a compressed (or uncompressed) copy.