# Getting Started with libLAS¶

## Processing¶

The libLAS ‘command-line utilities’ provide the bulk of
user-facing operational software for libLAS, although the underlying libLAS
library is what powers them. Below is a listing of common operations that
you might want to do on LAS data, and the utilities and approaches to
take to complete those tasks. The demo data can be found in `/home/user/data/las/srs.las`

### Reprojecting an LAS file¶

All LAS data are in some sort of coordinate system, even if that coordinate system is not described in the LAS file. For terrestrial LAS data, these coordinate system descriptions often map to coordinate systems described by the EPSG database. Another source of information about coordinate systems in http://spatialreference.org.

```
lasinfo --no-check srs.las
```

Note

The –no-check option tells lasinfo to only print the header information for the file and to not scan through all of the points. For a 10 point file, this of course isn’t much of a concern, but with a 50 or 500 million point file, it isn’t worth waiting for a full scan of the data if all you want is header information.

Our ‘lasinfo’ invocation tells us that the `srs.las`

file
is in a UTM North Zone 17 coordinate system:

```
PROJCS["WGS 84 / UTM zone 17N",
GEOGCS["WGS 84",
DATUM["WGS_1984",
SPHEROID["WGS 84",6378137,298.257223563,
AUTHORITY["EPSG","7030"]],
AUTHORITY["EPSG","6326"]],
PRIMEM["Greenwich",0],
UNIT["degree",0.0174532925199433],
AUTHORITY["EPSG","4326"]],
PROJECTION["Transverse_Mercator"],
PARAMETER["latitude_of_origin",0],
PARAMETER["central_meridian",-81],
PARAMETER["scale_factor",0.9996],
PARAMETER["false_easting",500000],
PARAMETER["false_northing",0],
UNIT["metre",1,
AUTHORITY["EPSG","9001"]],
AUTHORITY["EPSG","32617"]]
```

Now that we know our input coordinate system, we can make a decision about what to reproject the data to. In our first example, we’re going to use the venerable plate carrée non-coordinate system, EPSG:4326.

```
las2las srs.las --t_srs EPSG:4326
```

Our process succeeds, but after a quick inspection of the data with
`lasinfo output.las`

we see a problem:

```
...
Scale Factor X Y Z: 0.01 0.01 0.01
Offset X Y Z: -0.00 -0.00 -0.00
...
Min X, Y, Z: -83.43, 39.01, 170.58,
Max X, Y, Z: -83.43, 39.01, 170.76,
```

The `srs.las`

file had a scale of 0.01, or two decimal places of precision
for its X, Y, and Z coordinates. For UTM data, this is ok, because it implies
an implicit precision of 1 cm. For decimal degree data of the unprojected
Plate Carrée coordinate system, it causes us to lose a bunch of precision. We
need to set our scale values to something that can hold more precision in our
case:

```
las2las --t_srs EPSG:4326 srs.las --scale 0.000001 0.000001 0.01
```

Another quick inspection with ‘lasinfo’ gives us something we’re more comfortable with:

```
...
Scale Factor X Y Z: 0.000001 0.000001 0.01
Offset X Y Z: -0.000000 -0.000000 -0.00
...
Min X, Y, Z: -83.427598, 39.012599, 170.58
Max X, Y, Z: -83.427548, 39.012618, 170.76
```

### Output LAS file to text¶

```
las2txt input.las --parse xyzti
```