SPDLib Manual
The purpose of this page is to provide you the user with an overview of the supported file formats and available commands lines tools with details on there use.
For further practical examples see the example pages
SPDLib Tutorials
Tutorials can be found on the tutorials page
Supported File Formats
SPDLib has importers and exporters for many common file formats, these are listed below with brief descriptions of each.
Importers
| Format | Description |
|---|---|
| SPD | Sorted pulse data |
| UPD | Unsorted pulse data |
| LAS | Binary format unsorted, more info |
| ASCIIPULSEROW | |
| PTS | |
| ISITE_PTS | |
| CSV | |
| XYZ | |
| FWF_DAT | |
| DECOMPOSED_DAT | |
| DECOMPOSED_COO | |
| ASCIIMULTILINE | |
| Using Python |
Using Python
LiDAR data provides use a wide variety of ASCII formats to deliver data therefore it is not possible for us to provide readers for all possible formats (although we do intend to write some general readers which use a schema to define the data columns). Therefore, if the format your data was provided in is not currently supported then please let us know so we can look into supporting it in the future but you can use Python to convert your data to UPD files from which point the rest of SPDLib can be used to process your data.
An example script has been provided within spdlib/examples/python. See also Python bindings.
Exporters
SPDLib supports exporting data in a number of formats, listed below.
Using Python
As with the importers it is impossible for us to support every possible way of exporting the LiDAR data and to all formats therefore if you require something else then we suggest using the python bindings to create the files you require. But, please let us know if you do have needs for other file formats as we might be able to support these in later versions of the software, or at least include your python script within SPDLib
Command Line Tools
SPDLib has a set of command line tools for undertaking common tasks such as converting files to and from the SPD file format or classifying the LiDAR ground returns etc. The table below provides a list of all the available commands and links to a page describing the command and its use.
| Command | Description | Updated to ver 3 in wiki |
|---|---|---|
| spd2spd | Converts data to and from the SPD file format and allows changes to be made to an SPD file. | |
| spdclass | ||
| spdclearclass | ||
| spdconwave | ||
| spddecomp | Decompose full waveform data to create discrete points | x |
| spddefheight | Define the height field within pulses. | x |
| spddefrgb | ||
| spdelevation | ||
| spdgrdclass | ||
| spdgrderrors | ||
| spdinfo | Provides information about an SPD file. | |
| spdinterp | ||
| spdlastest | ||
| spdmccgrd | ||
| spdmerge | ||
| spdmetrics | Calculate metrics. | x |
| spdoverlap | ||
| spdplanegrd | Classify ground returns using a simple plane fitting approach. | |
| spdpmfgrd | Classify ground returns using a progressive morphological filter algorithm. | x |
| spdpolygrd | ||
| spdprofiles | ||
| spdproj | Print and convert projection strings. | |
| spdrangeimg | ||
| spdrmnoise | ||
| spdstats | Generate statistics image from an SPD file. | |
| spdsubset | Sub-setting of any of the supported input formats. | x |
| spdvecstats | ||
| spdwave | ||
| updsubset | Only applies to UPD files and allows the UPD file to be subset to a given number of pulses. |
Batch Processing Commands
A python script spdbatchgen.py has been provided and is installed alongside the SPD software which allows the use of a template listing the command sequence to be executed to be used to generate a script to easily batch process a large number of files.
Example
When spdbatchgen.py is called with the following input, all las-files in the folder /data/las/ are included in the procesing. A batch file named convert.sh is created with the following command:
spdbatchgen.py /data/las .las /data/spd /data/convert.sh /data/convertTemplate.sh --recurse=no
The file convertTemplate.sh contain the following:
mkdir /data/spd spdtranslate -i LAS -o SPD -b 10 --input_proj $PATH/epsg3006.wkt -x FIRST_RETURN -c 200 -r 200 $FILEPATH $PATH/$FILENAME_10m.spd spdpmfgrd -c 200 -r 200 -b 1 $PATH/$FILENAME_10m.spd $PATH/$FILENAME_10m_pmfgrd.spd spddefheight --interp -c 200 -r 200 -i NATURAL_NEIGHBOR $PATH$FILENAME_10m_pmfgrd.spd $PATH$FILENAME_10m_pmfgrd_h.spd rm $PATH/$FILENAME_10m.spd spdinterp --dtm --topo -i NATURAL_NEIGHBOR -f HFA -b 1 -c 200 -r 200 --overlap 10 $PATH/$FILENAME_10m_pmfgrd_h.spd $PATH/$FILENAME_1m_dtm.img spdinterp --dsm --height -i NATURAL_NEIGHBOR -f HFA -b 1 -c 200 -r 200 --overlap 10 $PATH/$FILENAME_10m_pmfgrd_h.spd $PATH/$FILENAME_1m_chm.img
Depending of the files you have in the folder /data/las, a file similar to this one is created with the name convert.sh:
# 663000-7586000 mkdir /data/spd spdtranslate -i LAS -o SPD -b 10 --input_proj /data/spd/epsg3006.wkt -x FIRST_RETURN -c 200 -r 200 /data/las/663000-7586000.las /data/spd/663000-7586000_10m.spd spdpmfgrd -c 200 -r 200 -b 1 /data/spd/663000-7586000_10m.spd /data/spd/663000-7586000_10m_pmfgrd.spd spddefheight --interp -c 200 -r 200 -i NATURAL_NEIGHBOR /data/spd663000-7586000_10m_pmfgrd.spd /data/spd663000-7586000_10m_pmfgrd_h.spd rm /data/spd/663000-7586000_10m.spd spdinterp --dtm --topo -i NATURAL_NEIGHBOR -f HFA -b 1 -c 200 -r 200 --overlap 10 /data/spd/663000-7586000_10m_pmfgrd_h.spd /data/spd/663000-7586000_1m_dtm.img spdinterp --dsm --height -i NATURAL_NEIGHBOR -f HFA -b 1 -c 200 -r 200 --overlap 10 /data/spd/663000-7586000_10m_pmfgrd_h.spd /data/spd/663000-7586000_1m_chm.img # 663000-7585000 mkdir /data/spd spdtranslate -i LAS -o SPD -b 10 --input_proj /data/spd/epsg3006.wkt -x FIRST_RETURN -c 200 -r 200 /data/las/663000-7585000.las /data/spd/663000-7585000_10m.spd spdpmfgrd -c 200 -r 200 -b 1 /data/spd/663000-7585000_10m.spd /data/spd/663000-7585000_10m_pmfgrd.spd spddefheight --interp -c 200 -r 200 -i NATURAL_NEIGHBOR /data/spd663000-7585000_10m_pmfgrd.spd /data/spd663000-7585000_10m_pmfgrd_h.spd rm /data/spd/663000-7585000_10m.spd spdinterp --dtm --topo -i NATURAL_NEIGHBOR -f HFA -b 1 -c 200 -r 200 --overlap 10 /data/spd/663000-7585000_10m_pmfgrd_h.spd /data/spd/663000-7585000_1m_dtm.img spdinterp --dsm --height -i NATURAL_NEIGHBOR -f HFA -b 1 -c 200 -r 200 --overlap 10 /data/spd/663000-7585000_10m_pmfgrd_h.spd /data/spd/663000-7585000_1m_chm.img
Help
spdbatchgen.py script generates the XML commands for the SPD software library from a user defined template Usage: python spdbatchgen.py <DIR> <EXT> <PATH> <OUTPUT> <TEMPLATE> --recurse=yes|no <DIR> - input directory of the files to be processed. <EXT> - file extension of the files of interest. <PATH> - path used for subsitution <OUTPUT> - the output file <TEMPLETE> - the template @ - Replaced with full file path ? - Replaced with file name $ - Replaced with <PATH> --recurse - whether the input <DIR> should be iteratively recused for files ending <EXT>.