PDAL on the VDI: data translation
Why PDAL translate
All data are not equal in the eyes of analysis packages or research purposes. So we need to translate datasets between standard formats, modify metdata, or apply transformations to the point data themselves. PDAL's translate application acts pretty much like GDAL's translate.
A number of possible scenarios are shown below, - step through some or all of them, and if you have a case that doesn't appear let the class know and we can work through it!
Case 1: I need to compress my LAS files to LAZ files
This is a common and really simple case. LAZ is an open, non-lossy compression format for LAS data which uses roughly one-fifth of the storage space - and many tools work transparently with the LAZ format. So we can save some pain on disk (or in file sharing) as follows:
$ pdal translate \ /g/data/rr1/Elevation/Merimbula0313/z55/2013/Mass_Points/LAS/AHD/LAS/Tiles_2k_2k/Merimbula2013-C3-AHD_7605910_55_0002_0002.las \ ./Merimbula2013-C3-AHD_7605910_55_0002_0002.laz
Check your work - in this case we see the LAZ version occupies about 1/8 of the space on disk.
$ du -hs /g/data/rr1/Elevation/Merimbula0313/z55/2013/Mass_Points/LAS/AHD/LAS/Tiles_2k_2k/Merimbula2013-C3-AHD_7605910_55_0002_0002.las $ du -hs ./Merimbula2013-C3-AHD_7605910_55_0002_0002.laz
Case 2: My tools require LAS 1.3, I have LAS 1.2
Not all LAS is created equally - and the specification has evolved with the surveying industry. Here we translate forward from 1.2 to 1.3. Notably, PDAL reads and translates LAS 1.4 just as easily:
$ pdal translate /g/data/rr1/Elevation/Merimbula0313/z55/2013/Mass_Points/LAS/AHD/LAS/Tiles_2k_2k/Merimbula2013-C3-AHD_7605910_55_0002_0002.las merimbula_las13.las --writers.las.minor_version=3
Use your knowledge of PDAL metadata to check your work
Case 3: I have points as text and I want to LAZ them
$ pdal translate /g/data/rr1/Elevation/Merimbula0313/z55/2013/Mass_Points/LAS/AHD/LAS/Tiles_2k_2k/Merimbula2013-C3-AHD_7605910_55_0002_0002.txt merimbula_las13.laz --writers.las.minor_version=3
Case 4: I need to reproject from GDA94 to UTM
First a note of caution - reprojection is always lossy. With LiDAR data the best practice is to regenerate points in the required projection, but that is not always possible.
Our UTM zone for this exercise is 55 South (EPSG:32755), so using PDAL we can do:
$ pdal translate \ /g/data/rr1/Elevation/Merimbula0313/z55/2013/Mass_Points/LAS/AHD/LAS/Tiles_2k_2k/Merimbula2013-C3-AHD_7605910_55_0002_0002.las \ Merimbula2013-C3-UTM_7605910_55_0002_0002_EPSG32755.laz --filters.reprojection.out_srs="EPSG:32755"
- Check the metadata of your LAZ tile from exercise 1 to see if your compressed data are actually the same as the uncompressed data
- One for esoteric LAS users: the LAS specification has different point storage formats as well as different versions. Alter the point storage format of your LAS tile.
- What else can you translate your LAS tile to? Try to convert your LAS tile to some different formats.
- How can we verify that our reprojection has worked? Have a brainstorm, and discuss with the workshop group.
- Check the setup lesson for metadata hints.
- You can set LAS point formats using the --writers.las options in PDAL. See: http://www.pdal.io/stages/writers.las.html
- Read the docs at http://www.pdal.io/apps/translate.html - and discuss your findings among the group