[pdal] How to get the metadata of a file?
Andrew Bell
andrew.bell.ia at gmail.com
Thu Sep 10 07:27:17 PDT 2020
On Thu, Sep 10, 2020 at 9:43 AM Peder Axensten <Peder.Axensten at slu.se>
wrote:
> I want to implement a writer that takes a point cloud file and rasterises
> it (percentiles and other statistics):
> class Raster_metrics : public pdal::Writer;
>
> My understanding from the documentation is that I should setup things in
> void Raster_metrics::ready( pdal::PointTableRef table );
> Correct?
> To do that I need to access the header data of the input file,
> specifically its bounding box.
>
PDAL typically works on PointView objects rather than PointTable objects.
Normally one would calculate the bounds based on PointView in either
filter() or run(). Search for calculateBounds(). It would not be
unreasonable to create a separate raster for each input PointView.
How do I get the input file’s bounding box from table?
>
You don't.
> And other file metadata?
>
Metadata is generally stored with each stage. If you want the metadata that
was read, you have to walk stages back until you find the one you're
looking for, call getMetadata(), and then extract any information you're
looking for. We don't usually use file metadata during processing, with the
exception of spatial reference, which is stored separately. We don't use
metadata-provided bounding boxes because 1) they have been known to be
wrong 2) PDAL may aggregate and drop points in between the time that data
is read and the time that a filter is run.
Further I should process the actual points in
> void Raster_metrics::write( pdal::PointViewPtr view ) — for chunks of
> points.
> Correct?
> I want to be able to process points also in a serialised manner – in what
> member function should I do that?
>
I don't know what you mean. You can simply loop through all the points in
the view and process them one at a time. If you don't need all the points
prior to beginning processing, you can implement a stream mode filter by
inheriting from Streamable and implement processOne(). That said, if you
need bounds, you need all the points, which means that your filter won't
work in stream mode.
And finally I should calculate the statistics and output the these as
> rasters [using gdal] in
> void Raster_metrics::done( pdal::PointTableRef table )
> Correct?
>
This is up to you. Using the new functionality in 2.2, you can call
view.createRaster(). It will return a raster to which you can write data. I
would do this in filter() or run().
I’ve been reading through the documentation on pdal.io, but I find it a bit
> scant – is there more detailed documentation somewhere?
> (I.e. https://pdal.io/api/cpp/metadata.html is just a list of member
> functions.)
>
What is available on the PDAL website is what exists. We don't have much
documentation of individual functions. Sorry. Please make use of the
existing code and tests. Feel free to write with specific questions.
--
Andrew Bell
andrew.bell.ia at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/pdal/attachments/20200910/d4160eca/attachment.html>
More information about the pdal
mailing list