Reading with PDAL


Bradley Chambers




This tutorial is an introduction to using PDAL to read data using pdal from the command line.

A basic inquiry example

Our first example to demonstrate PDAL’s utility will be to simply query an LAS file to determine the data that are in it in the very first point.


The interesting.las file in these examples can be found on github.

pdal info outputs JavaScript JSON.

$ pdal info interesting.las -p 0
  "filename": "interesting.las",
  "pdal_version": "1.0.1 (git-version: 80644d)",
      "Blue": 88,
      "Classification": 1,
      "EdgeOfFlightLine": 0,
      "GpsTime": 245381,
      "Green": 77,
      "Intensity": 143,
      "NumberOfReturns": 1,
      "PointId": 0,
      "PointSourceId": 7326,
      "Red": 68,
      "ReturnNumber": 1,
      "ScanAngleRank": -9,
      "ScanDirectionFlag": 1,
      "UserData": 132,
      "X": 637012,
      "Y": 849028,
      "Z": 431.66

A conversion example

Conversion of data from one format to another may be lossy, in that some data in the source format may not be representable in the same format or at all in the destination format. For example, some formats don’t support spatial references for point data, some have no metadata support and others have limited dimension support. Even when data types are supported in both source and destination formats, there may be limitations with regard to data type, precision or, scaling. PDAL attempts to convert data as accurately as possible, but you should make sure that you’re aware of the capabilities of the data formats you’re using.

$ pdal translate interesting.las output.txt

The text format supports all point attributes, but provides no support for metadata such as the input spatial reference system or the LAS header fields, such as UUID. You may need to preserve some more information as part of your conversion to make it useful down the road.


PDAL carries metadata for each stage through the PDAL processing pipeline. The metadata can be written in JSON form using the pdal info command

$ pdal info --metadata interesting.las

This produces metadata that looks like this. You can use your JSON manipulation tools to extract this information. For formats that do not have the ability to preserve this metadata internally, you can keep a .json file alongside the .txt file as auxiliary information.

A Pipeline Example

The full power of PDAL comes in the form of pipeline invocations. Pipelines allow you to take advantage of PDAL’s ability to manipulate data as they are converted. This section will provide a basic example and demonstration of pipeline usage. See the pipeline specification, for more detailed exposition of the topic.

The pipeline describes a series of processing stages to be performed in JSON format. Each stage can be provided a set of options that control the details of processing. PDAL is single-threaded and stages are executed in a linear order. Some stages support what is known as “stream mode”. If all stages in a pipeline support stream mode the command is run using using stream mode to reduce the memory processing footprint. Even when run in stream mode, execution is single-threaded and can be thought of as linear.

Simple conversion

The following JSON document defines a pipeline that takes the file.las LAS file and converts it to a new file called output.las.


Loop a directory and filter it through a pipeline

This bash script loops through a directory and pushes the las files through a pipeline, substituting the input and output as it goes.

ls *.las | cut -d. -f1 | xargs -P20 -I{} pdal pipeline -i /path/to/proj.json --readers.las.filename={}.las --writers.las.filename=output/{}.laz

Here is an example doing something similar with Windows PowerShell

get-childitem $indir |
foreach-object {
    if ($_.extension -ne ".las") {
    $outname = $outdir + "\" + $
    pdal pipeline -i \path\to\proj.json $_.fullname $outname