~ubuntu-branches/ubuntu/trusty/liblas/trusty-proposed

« back to all changes in this revision

Viewing changes to doc/start.txt

  • Committer: Package Import Robot
  • Author(s): Francesco Paolo Lovergine
  • Date: 2014-01-05 17:00:29 UTC
  • mfrom: (7.1.2 sid)
  • Revision ID: package-import@ubuntu.com-20140105170029-ddtp0j63x5jvck2u
Tags: 1.7.0+dfsg-2
Fixed missing linking of system boost component.
(closes: #733282)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
.. _start:
 
2
 
 
3
******************************************************************************
 
4
Getting Started with libLAS
 
5
******************************************************************************
 
6
 
 
7
.. contents::
 
8
    :depth: 3
 
9
    :backlinks: none
 
10
 
 
11
 
 
12
 
 
13
:Author: Howard Butler
 
14
:Contact: hobu.inc at gmail dot com
 
15
 
 
16
    
 
17
Overview
 
18
------------------------------------------------------------------------------
 
19
 
 
20
libLAS is two things: a library for embedding read and write support of the 
 
21
ASPRS LAS format into your own C/C++ applications, and a suite of command-line 
 
22
utilities based on :ref:`LASTools <lastools_liblas>` for inspecting, manipulating, 
 
23
transforming, and processing LAS LiDAR data.
 
24
 
 
25
This document is an entry point into the world of libLAS, and will give a 
 
26
general overview of the types of operations you can do with the :ref:`libLAS utilities <utilities>` 
 
27
as well as point you to other information for developing your own applications 
 
28
with libLAS.  
 
29
 
 
30
Installation
 
31
------------------------------------------------------------------------------
 
32
 
 
33
:ref:`download` contains the canonical location for obtaining libLAS in 
 
34
both source and binary forms.  
 
35
 
 
36
Windows
 
37
..............................................................................
 
38
 
 
39
:ref:`osgeo4w_install` contains information how to install libLAS on Windows.  
 
40
 
 
41
Unix
 
42
..............................................................................
 
43
 
 
44
Packages are available for `DebianGIS`_, but in most other cases you are 
 
45
going to have to compile libLAS yourself. :ref:`compilation` provides an 
 
46
extensive synopsis of how to do so.
 
47
 
 
48
Compilation
 
49
..............................................................................
 
50
 
 
51
:ref:`compilation` shows how to compile libLAS for your own use on Windows,
 
52
Mac OSX, and Linux. 
 
53
    
 
54
Processing
 
55
------------------------------------------------------------------------------
 
56
 
 
57
The libLAS :ref:`command-line utilities <utilities>` provide the bulk of 
 
58
user-facing operational software for libLAS, although the underlying libLAS 
 
59
library is what powers them.  Below is a listing of common operations that 
 
60
you might want to do on LAS data, and the utilities and approaches to 
 
61
take to complete those tasks.
 
62
 
 
63
Reprojecting an LAS file
 
64
..............................................................................
 
65
 
 
66
All LAS data are in some sort of coordinate system, even if that coordinate 
 
67
system is not described in the LAS file.  For terrestrial LAS data, these 
 
68
coordinate system descriptions often map to coordinate systems described 
 
69
by the `EPSG`_ database.  Another source of information about coordinate 
 
70
systems in http://spatialreference.org.  
 
71
 
 
72
The :ref:`las2las <las2las>` utility is the tool you will want to use to 
 
73
reproject LAS data.  :ref:`las2las <las2las>` can take advantage of the 
 
74
existing coordinate system description that might already be specified in the 
 
75
LAS file, or you may override the coordinate system description (or supply 
 
76
one if none was specified).
 
77
 
 
78
We're going to use an example file at http://liblas.org/samples/srs.las which 
 
79
contains only 10 points and has a coordinate system defined.  Please 
 
80
download this file if you want to follow along.
 
81
 
 
82
:ref:`las2las <las2las>` is very similar in behavior to another data 
 
83
translation utility for raster data -- `gdal_translate`_.  To reproject data, 
 
84
we must have a description of both the coordinate system we are starting with 
 
85
and a description of the coordinate system we are going to.  To find out what 
 
86
you are starting with, issue a :ref:`lasinfo <lasinfo>` command:
 
87
 
 
88
::
 
89
    
 
90
    lasinfo --no-check srs.las
 
91
 
 
92
.. note::
 
93
 
 
94
    The --no-check option tells lasinfo to only print the header information 
 
95
    for the file and to not scan through all of the points.  For a 10 point file, 
 
96
    this of course isn't much of a concern, but with a 50 or 500 million point 
 
97
    file, it isn't worth waiting for a full scan of the data if all you 
 
98
    want is header information.
 
99
 
 
100
Our :ref:`lasinfo <lasinfo>` invocation tells us that the ``srs.las`` file 
 
101
is in a UTM North Zone 17 coordinate system:
 
102
 
 
103
::
 
104
 
 
105
    PROJCS["WGS 84 / UTM zone 17N",
 
106
        GEOGCS["WGS 84",
 
107
            DATUM["WGS_1984",
 
108
                SPHEROID["WGS 84",6378137,298.257223563,
 
109
                    AUTHORITY["EPSG","7030"]],
 
110
                AUTHORITY["EPSG","6326"]],
 
111
            PRIMEM["Greenwich",0],
 
112
            UNIT["degree",0.0174532925199433],
 
113
            AUTHORITY["EPSG","4326"]],
 
114
        PROJECTION["Transverse_Mercator"],
 
115
        PARAMETER["latitude_of_origin",0],
 
116
        PARAMETER["central_meridian",-81],
 
117
        PARAMETER["scale_factor",0.9996],
 
118
        PARAMETER["false_easting",500000],
 
119
        PARAMETER["false_northing",0],
 
120
        UNIT["metre",1,
 
121
            AUTHORITY["EPSG","9001"]],
 
122
        AUTHORITY["EPSG","32617"]]
 
123
 
 
124
Now that we know our input coordinate system, we can make a decision about 
 
125
what to reproject the data to.  In our first example, we're going to use 
 
126
the venerable plate carrée non-coordinate system, `EPSG:4326`_.
 
127
 
 
128
::
 
129
 
 
130
    las2las srs.las --t_srs EPSG:4326
 
131
 
 
132
Our process succeeds, but after a quick inspection of the data with 
 
133
``lasinfo output.las`` we see a problem:
 
134
 
 
135
::
 
136
 
 
137
    ...
 
138
    Scale Factor X Y Z:          0.01 0.01 0.01
 
139
    Offset X Y Z:                -0.00 -0.00 -0.00
 
140
    ...
 
141
    Min X, Y, Z:                -83.43, 39.01, 170.58, 
 
142
    Max X, Y, Z:                -83.43, 39.01, 170.76,
 
143
 
 
144
The ``srs.las`` file had a scale of 0.01, or two decimal places of precision
 
145
for its X, Y, and Z coordinates. For UTM data, this is ok, because it implies
 
146
an implicit precision of 1 cm. For decimal degree data of the unprojected
 
147
Plate Carrée coordinate system, it causes us to lose a bunch of precision. We
 
148
need to set our scale values to something that can hold more precision in our
 
149
case:
 
150
 
 
151
::
 
152
 
 
153
    las2las --t_srs EPSG:4326 srs.las --scale 0.000001 0.000001 0.01
 
154
 
 
155
Another quick inspection with :ref:`lasinfo <lasinfo>` gives us something 
 
156
we're more comfortable with:
 
157
 
 
158
::
 
159
 
 
160
    ...
 
161
    Scale Factor X Y Z:          0.000001 0.000001 0.01
 
162
    Offset X Y Z:                -0.000000 -0.000000 -0.00
 
163
    ...
 
164
    Min X, Y, Z:                -83.427598, 39.012599, 170.58
 
165
    Max X, Y, Z:                -83.427548, 39.012618, 170.76    
 
166
 
 
167
Vertical datum transformation of an LAS file
 
168
..............................................................................
 
169
 
 
170
We're going to continue what we were doing in `Reprojecting an LAS file`_ but 
 
171
add a twist -- we want to change the vertical datum on the data from WGS84
 
172
to NAVD88.
 
173
 
 
174
.. warning:
 
175
 
 
176
    A number of requirements are needed before you can do vertical datum
 
177
   transformations with libLAS. The most important is GDAL support, of course,
 
178
   but you also need a very current (possibly even unreleased) version of
 
179
   `Proj.4`_ and the vertical datum .gtx transformation files. If you're using
 
180
   :ref:`osgeo4w_install`, you already have all of this installed when you
 
181
   installed libLAS. For Linux or other Unix platforms, you should be aware of
 
182
   these requirements.
 
183
    
 
184
Assuming you have all of the prerequisites in place, we can do the vertical 
 
185
datum transformation quite simply (again, worrying about precision as well):
 
186
 
 
187
 
 
188
::
 
189
 
 
190
    las2las srs.las --t_srs EPSG:4326+5703 --scale 0.000001 0.000001 0.01
 
191
 
 
192
The key point there is adding `+5703` to the coordinate system description 
 
193
tells the GDAL/Proj.4 machinery to do a vertical transformation.  There are 
 
194
other ways to have these operations happen using `WKT`_ and even GeoTIFF 
 
195
keys, but this is the most simple way to do things via command line.
 
196
 
 
197
Assigning color information to a LAS file
 
198
..............................................................................
 
199
 
 
200
.. note::
 
201
 
 
202
    The following example assumes you are working with the `Autzen_Stadium`_
 
203
    example file that is available from the http://liblas.org/sample sample
 
204
    library.
 
205
 
 
206
   
 
207
Frequent availability of combined terrestrial LiDAR and image captures means 
 
208
that its now possible to obtain .las files that you can stylize with RGB 
 
209
imagery.  The LAS 1.2 specification provides two different point data 
 
210
types that allow storing RGB data as 16 bit integers, but the tools to 
 
211
do the actual intersection operation have been somewhat limited.  
 
212
 
 
213
libLAS 1.6+ allows you to assign color information to a .las file if `GDAL`_ 
 
214
is linked in at compile-time.  
 
215
 
 
216
.. note::
 
217
    The :ref:`LAS specifications <specifications>` only allow two different
 
218
    point format types to store color information -- point format 2 and point
 
219
    format 3. The difference between point format 2 and point format 3 is that
 
220
    3 also has time stored on it. Additionally, only LAS 1.2 and 1.3 versions
 
221
    support storing color information, but libLAS only can write LAS 1.2 as of
 
222
    libLAS 1.6.0.
 
223
 
 
224
 
 
225
 
 
226
1. Unzip the `Autzen Stadium <Autzen_Stadium>`_ data.
 
227
    
 
228
    ::
 
229
    
 
230
        $ unzip Autzen_Stadium.zip
 
231
        Archive:  Autzen_Stadium.zip
 
232
         creating: Autzen_Stadium/
 
233
         inflating: Autzen_Stadium/image.tif  
 
234
         inflating: Autzen_Stadium/lidar.las 
 
235
 
 
236
2. Issue the :ref:`las2las <las2las>` call
 
237
 
 
238
    ::
 
239
    
 
240
        $   las2las -i lidar.las \
 
241
                    --color-source image.tif \
 
242
                    -o output.las \
 
243
                    --file-format 1.2 \
 
244
                    --point-format 3 \
 
245
                    -v
 
246
 
 
247
    ::
 
248
    
 
249
        Opening lidar.las to fetch Header
 
250
        Setting format to: 1.2
 
251
        Setting point format to: 3
 
252
        Fetching color from ' image.tif' using bands '1, 2, 3' for R, G, B
 
253
        Writing output:
 
254
         - : output.las
 
255
        0...10...20...30...40...50...60...70...80...90...100 - done.
 
256
 
 
257
3.  Inspect the :ref:`lasinfo <lasinfo>` output and see color information 
 
258
    attached.
 
259
 
 
260
    ::
 
261
        
 
262
        lasinfo output.las
 
263
        
 
264
        ...
 
265
        
 
266
          Minimum Color:        39 56 56 
 
267
          Maximum Color:        252 254 251
 
268
 
 
269
.. note::
 
270
    :ref:`assign_color` contains more detailed information about this process.
 
271
 
 
272
Compressing an LAS file with `LASzip`_
 
273
..............................................................................
 
274
 
 
275
libLAS provides the ability to compress data using the fantastic `LASzip`_ 
 
276
compression library.
 
277
 
 
278
 
 
279
 
 
280
.. _`LASzip`: http://laszip.org
 
281
.. _`CMake`: http://www.cmake.org/
 
282
.. _`CTest`: http://cmake.org/cmake/help/ctest-2-8-docs.html
 
283
.. _`CMake 2.8.0+`: http://www.cmake.org/cmake/help/cmake-2-8-docs.html
 
284
.. _`CDash`: http://www.cdash.org/
 
285
.. _`continuous integration`: http://en.wikipedia.org/wiki/Continuous_integration
 
286
.. _`libLAS CDash`: http://my.cdash.org/index.php?project=libLAS
 
287
.. _`Curses`: http://en.wikipedia.org/wiki/Curses_%28programming_library%29
 
288
.. _`Autoconf`: http://www.gnu.org/software/autoconf/
 
289
.. _`LLVM`: http://llvm.org/
 
290
.. _`OSGeo4W`: http://trac.osgeo.org/osgeo4w/
 
291
.. _`Boost`: http://www.boost.org/
 
292
.. _`DebianGIS`: http://wiki.debian.org/DebianGis
 
293
.. _`gdal_translate`: http://www.gdal.org/gdal_translate.html
 
294
.. _`EPSG`: http://www.epsg-registry.org/
 
295
.. _`EPSG:4326`: http://spatialreference.org/ref/epsg/4326/
 
296
.. _`Proj.4`: http://trac.osgeo.org/proj/
 
297
.. _`WKT`: http://en.wikipedia.org/wiki/Well-known_text#Spatial_reference_systems
 
298
.. _`GDAL`: http://gdal.org
 
299
.. _`Autzen_Stadium`: http://liblas.org/samples/Autzen_Stadium.zip