User Examples

Merging a set of input tiles

When LiDAR data is delivered it is commonly provided as a set of small tiles in the las format. The small tiles are provided as processing large LiDAR datasets without a spatial index can be very memory and computational expensive. As the spdlib format provides a spatial index the datasets can be processed in larger units. Therefore we common wish to merge the tiles provided and generate a spatially index spd file. The following commands show how this is done where the output is index on a 10 m grid.

spdmerge -i las -x LAST_RETURN Aorere_20April2011.spd BN241106.las BN241205.las BN241207.las BN241305.las BN241405.las BN241504.las BN241506.las BN241606.las BN241706.las BN241806.las BN241107.las BN241206.las BN241304.las BN241404.las BN241406.las BN241505.las BN241605.las BN241705.las BN241805.las
 
mkdir tmp
 
spdtranslate -i SPD -o SPD -b 10 --temppath ./tmp/ --numofcols 100 --numofrows 100 --usetmp -x LAST_RETURN Aorere_20April2011.spd Aorere_20April2011_10m.spd
 
rm -Rf tmp

Importing LAS 1.3 waveform data - via python binding

The libLAS library which is used to import and export LAS files does not currently support the LAS 1.3 (or 1.4) waveform specification. Therefore, to import this data a python script has been provided which will convert the data within the LAS file to non-indexed SPD files.

To use this script you must have the spdlib python binding installed and within you path. To check this run the following from a terminal.

python
>>> import spdpy

If no error message is produced then the SPD python binding is installed. Running the python help system, as shown below, will provided some help documentation on the python binding if required.

python
>>> import spdpy
>>> help(spdpy)

The LAS 1.3 importer is within the directory python/importers within the spdlib trunk. The script is called LASWave2UPD.py, if you run the script with no options the following measure will be printed out.

LASWave2UPD.py script converts a LAS 1.3 file to a UPD File.
 
Print LAS header info:
LASWave2UPD.py -header <input file>
Convert Waveforms Only:
LASWave2UPD.py -waves <input file> <output file>
Convert Points Only (each point creates new pulse):
LASWave2UPD.py -pulpoints <input file> <output file>
Debug Waveforms - print to console:
LASWave2UPD.py -wavesdb <input file> <start point> <num points>
Debug Points -print to console:
LASWave2UPD.py -pointsdb <input file> <start point> <num points>
 
 
This script was distributed with version 3.0.0 of SPDLib's
python bindings.
For maintainance email spdlib-develop@lists.sourceforge.net

The script has only quickly been put together and is not fully developed therefore the point data and waveforms are independently extracted (the data I have so far seen had issues with linking the points and waveforms!!) therefore to extract the points from the file the script can be run as follows.

python LASWave2UPD.py -pulpoints LDR100301_120340_4.LAS LDR100301_120340_4_spd_pts.spd

while to extract the waveforms the following command should be used.

python LASWave2UPD.py -waves LDR100301_120340_4.LAS LDR100301_120340_4_spd_waves.spd

Once these are extracted to non-indexed SPD files they can be indexed using spdtranslate and processed using any of the other spdlib commands (such as spddecomp to decompose the waveform data and extract points).

spdtranslate -i SPD -o SPD -b 5 ./LDR100301_120340_4_spd_pts.spd LDR100301_120340_4_spd_pts_5m.spd

Waveform files are usually quite large in size and therefore require more memory for processing it is therefore recommended that tiling is used when converted to an indexed SPD file, as shown below.

spdtranslate -i SPD -o SPD -b 5 --usetmp --temppath ./tmp/ -r 50 -c 50 ./LDR100301_120340_4_spd_waves.spd ./LDR100301_120340_4_spd_waves_5m.spd

Debugging LAS 1.3 waveform data import process

The python script also offers three debug options which print information to the console. Specifically, just the header (-header), point (-pointsdb) and waveforms (-wavesdb) can be printed to the console. The header option only expects a single input file while the points and waveforms debug options additionally expect a start point id (try 0 first!) and the number of points to be printed (try 5 first).


Navigation