[pdal] How to get las header info?

Peder Axensten Peder.Axensten at slu.se
Tue Jul 5 07:50:36 PDT 2022


Hello again,

I tried the 2.4.2 version and I notice that the copy and move constructors (and operators) are now implemented.
But pdal::LasHeader now lacks the default constructor, so this code still does not work:

    pdal::LasHeader get_header( const std::filesystem::path & path_ ) {
        pdal::LasHeader          header{};   // error: no matching constructor for initialization of 'pdal::LasHeader'
        pdal::ILeStream          input{ path_.native() };
        input >> header;
        return header;
    }

What would be the correct way to read the header information from my code?
It would be nice to do it for any point cloud file, but I’m happy to settle for las/laz files.

Best regards,

Peder Axensten
Systems Developer

Remote Sensing
Department of Forest Resource Management
Swedish University of Agricultural Sciences
SE-901 83 Umeå
Visiting address: Skogsmarksgränd
Phone: +46 90 786 85 00
peder.axensten at slu.se, www.slu.se/srh

The Department of Forest Resource Management is environmentally certified in accordance with ISO 14001.

> On 23 Mar 2022, at 12:34, Andrew Bell <andrew.bell.ia at gmail.com> wrote:
>
> On Wed, Mar 23, 2022 at 5:14 AM Peder Axensten <Peder.Axensten at slu.se> wrote:
> Dear list,
>
> Previously, I could obtain a pdal::LasHeader through:
>
> inline pdal::LasHeader get_header( const std::filesystem::path & path_ ) {
> pdal::LasHeader header;
> pdal::ILeStream input{ path_.native() };
> input >> header;
> return header;
> }
>
> But in the latest version of pdal the header copy constructor is implicitly deleted.
>
> This issue has already been reported and fixed and will be included in the final 2.4 release:
>
>  https://github.com/PDAL/PDAL/pull/3713
>
> The tool needs to process all las-files of a specified directory (and its sud-directories). If I need to read the contents of files that could actually be ignored, it would increase processing time probably tenfolds. Is there a way to avoid this?
>     Maybe a previous stage in the pipeline to filter files based only on their header (bounding box) info?
>     If I implement it as a streaming operation, could I get the bounding box from header info and possibly not stream anything?
>
> The bounding box of a LAS file is always stored at offsets 179-226, so you can read them directly if you like, but as I said above, I have re-enabled copying of LasHeader.
>
> --
> Andrew Bell
> andrew.bell.ia at gmail.com

---
När du skickar e-post till SLU så innebär detta att SLU behandlar dina personuppgifter. För att läsa mer om hur detta går till, klicka här <https://www.slu.se/om-slu/kontakta-slu/personuppgifter/>
E-mailing SLU will result in SLU processing your personal data. For more information on how this is done, click here <https://www.slu.se/en/about-slu/contact-slu/personal-data/>


More information about the pdal mailing list