Ian
Ian

Reputation: 1

PDAL writers.raster: set bounds

Is anyone aware of a method to set the bounds of a GTiff in the PDAL writers.raster similar to the method in writers.gdal? The idea is to ensure the output raster is the same bounds as the input las.

writers.raster example:

{
"pipeline": [
    {
        "type": "readers.las"
    },
    {
        "type": "filters.range",
        "limits": "Classification[2:2]"
    },
    {
        "type": "writers.raster"
    }
]

}

Example using writers.gdal:

{
"pipeline": [
    {
        "type": "readers.las"
    },
    {
        "type": "filters.range",
        "limits": "Classification[2:2]"
    },
    {

        "type": "writers.gdal",
        "gdaldriver": "GTiff",
        "output_type": "mean",
        "bounds": ***OUTPUT BOUNDS SET HERE***
    }
]

}

Writers.raster does not offer the same setting. Writers.gdal cannot be used in my case.

Ideally, setting the output bounds would happen in the pipeline and avoid a second external step like gdal.Translate.

Maybe I am missing something obvious?

Upvotes: 0

Views: 72

Answers (1)

Ian
Ian

Reputation: 1

Potential Solution.

Leverage filters.faceraster for bounds extents. Faceraster allows for setting an origin and users can work out a raster size based on pixel height and width. Ideally, the bounds could be set at the writers.raster stage, but this is the solution I have at the moment to work and the use of writers.gdal.

{
    "pipeline": [
        {
            "type": "readers.las"
        },
        {
            "type": "filters.range",
            "limits": "Classification[2:2]"
        },
        {
            "type": "filters.delaunay"
        },
        {
            "type": "filters.faceraster"
            "resolution": ***SET RESO***,
            "origin_x": ***SET X ORIGIN***,
            "origin_y": ***SET Y ORIGIN***,
            "width": ***NUM OF PIXELS WIDE***,
            "height": ***NUM OF PIXELS HEIGHT***
        },
        {

            "type": "writers.raster"
        }
    ]
}

IMO, setting the bounds at the writers.faceraster stage similar to writers.gdal is a more robust solution and avoids unforeseen errors when reconstructing the raster via the origin and bounds methods, but this is a good patch for my process for now.

Upvotes: 0

Related Questions