Printing file metadata


This exercise uses PDAL to print metadata information. Issue the following command in your OSGeo4W Shell.

pdal info c:/Users/hobu/PDAL/exercises/info/interesting.las --metadata


PDAL metadata is returned a in a tree structure corresponding to processing pipeline that produced it.

See also

Use the JSON processing capabilities of your favorite processing software to selectively access and manipulate values.

Structured Metadata Output

Many command-line utilities output their data in a human-readable custom format. The downsides to this approach are significant. PDAL was designed to be used in the context of other software tools driving it. For example, it is quite common for PDAL to be used in data validation scenarios. Other programs might need to inspect information in PDAL’s output and then act based on the values. A human-readable format would mean that downstream program would need to write a parser to consume PDAL’s special format.

JSON provides a nice balance between human- and machine- readable, but even then it can be quite hard to find what you’re looking for, especially if the output is long. pdal command output used in conjunction with a JSON parsing tool like jq provide a powerful inspection combination.

For example, we might only care about the system_id and compressed flag for this particular file. Our simple pdal info --metadata command gives us that, but it also gives us a bunch of other stuff we don’t need at the moment either. Let’s focus on extracting what we want using the jq command.

pdal info c:/Users/hobu/PDAL/exercises/info/interesting.las --metadata ^
    | jq  ".metadata.compressed, .metadata.system_id"


PDAL’s JSON output is very powerfully combined with the processing capabilities of other programming languages such as JavaScript or Python. Both of these languages have excellent built-in tools for consuming JSON, along with plenty of other features to allow you to do something with the data inside the data structures. As we will see later in the workshop, this PDAL feature is one that makes construction of custom data processing workflows with PDAL very convenient.


  1. PDAL uses JSON as the exchange format when printing information from info. JSON is a structured, human-readable format that is much simpler than its XML cousin.
  2. The PDAL metadata document contains background and information about specific metadata entries and what they mean.
  3. Metadata available for a given file depends on the stage that produces the data. Readers produce same-named values where possible, but it is common that variables are different. Filters and even writers can also produce metadata entries.
  4. Spatial reference system or coordinate system information is a kind of special metadata, and is treated as something primary to a Stage in PDAL.