[pdal] JSON pipelines

Bradley Chambers brad.chambers at gmail.com
Thu Mar 10 08:47:38 PST 2016


Interested in specifying your PDAL pipeline as a JSON [1] rather than XML?

If you are building from PDAL master [2] or running the latest PDAL docker
image [3], you now can!

For many pipelines, the JSON representation is much easier on the eyes. For
example, a simple conversion from LAS to LAZ in XML is:

<?xml version="1.0" encoding="utf-8"?>
<Pipeline version="1.0">
    <Writer type="writers.las">
        <Option name="filename">
            output.laz
        </Option>
        <Reader type="readers.las">
            <Option name="filename">
                input.las
            </Option>
        </Reader>
    </Writer>
</Pipeline>

In JSON, this is simplified to:

{
    "pipeline":[
        "input.las",
        "output.laz"
    ]
}

Of course, you can still set options on the stages.

{
    "pipeline":[
        "input.bpf",
        {
            "filename":"output.las",
            "scale_x":0.01,
            "scale_y":0.01,
            "scale_z":0.01,
        }
    ]
}

And insert filtering operations.

{
    "pipeline":[
        {
            "filename":"input.las",
            "spatialreference":"EPSG:2027"
        },
        {
            "type":"filters.reprojection",
            "out_srs":"EPSG:2028"
        },
        "output.laz"
    ]
}

Unless otherwise specified, pipelines are processed top-down, with each
stage serving as input to the subsequently specified stage. But...

Using tags, you can now also wire up pipelines in a way that would not have
been possible given the XML syntax. For example, the following pipeline
specifies multiple readers that are merged together, but only after one has
been passed through a decimation filter.

{
    "pipeline":[
        {
            "filename":"input1.las",
            "tag":"reader1"
        },
        {
            "filename":"input2.las",
            "tag":"reader2"
        },
        {
            "type":"filters.decimation",
            "step":2,
            "inputs":[
                "reader1"
            ],
            "tag":"sampled"
        },
        {
            "type":"filters.merge",
            "inputs":[
                "sampled",
                "reader2"
            ]
        },
        "output.las"
    ]
}

The full JSON pipeline specification can be found here [4].

Of course, if you'd rather not make the switch, the PDAL pipeline command,
for now, will continue to accept XML pipelines.

Happy processing!

Brad

[1] http://www.json.org/
[2] https://github.com/PDAL/PDAL/tree/master
[3] https://hub.docker.com/r/pdal/pdal/
[4]
https://github.com/PDAL/PDAL/blob/master/doc/json_pipeline_specification.rst
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/pdal/attachments/20160310/2727484d/attachment.html>


More information about the pdal mailing list