[pdal] libLAS to PDAL, how to write a LAS header from scratch in PDAL?

Chris Lee coolccinc at gmail.com
Thu Sep 2 08:20:25 PDT 2021


Mathieu,

The header min/max is set automatically by PDAL based on your data. Usually
that error is due to an incorrect scale/offset. Could you send the writer
pipeline you're using? I suggest using a scale factor of "0.01" or "0.001"
for projected coordinate systems, and "auto" for the offset, as follows:

{
"type":"writers.las",
"filename":"outputfile.las",
"offset_x":"auto",
"offset_y":"auto",
"offset_z":"auto",
"scale_x":"0.01",
"scale_y":"0.01",
"scale_z":"0.01"
}

Let me know if it helps!
Chris

On Thu, Sep 2, 2021 at 9:48 AM Mathieu Poulin <
mathieu.poulin at mvtgeosolutions.com> wrote:

> Hi Andrew,
>
> Using options does seem to work but there is one thing I cannot find in
> the documentation and that is the min and max bounds. Previously, I used
> the header SetMin and SetMax functions. I have tried setting options for
> "min_x", "max_x", etc., I also tried the "bounds" option and tried to pass
> a BOX3D object to it and then a string with the correct format described
> here: https://pdal.io/stages/filters.crop.html#options, but nothing seems
> to work, I keep getting an error saying something along the lines of
> "unexpected argument".
>
> The reason I am trying to do this is because I am getting an error that
> says: writers.las: Unable to convert scaled value (2.307896276e+12) to in32
> for dimension 'X'. I found that the error is mentioned in the FAQ:
> https://pdal.io/faq.html. The thing is, I never had problems with
> positions fitting into a 32-bit integer before I switched to PDAL. I assume
> this is because I have not set my bounds properly, but I can't really be
> certain, it could also be that the scale or offset work differently in PDAL.
>
> Could you help me fix this problem?
>
> Regards,
>
> - Mathieu Poulin
>
>
> ------------------------------
> *From:* Andrew Bell <andrew.bell.ia at gmail.com>
> *Sent:* Tuesday, August 31, 2021 9:20 AM
> *To:* Mathieu Poulin <mathieu.poulin at mvtgeosolutions.com>
> *Cc:* pdal at lists.osgeo.org <pdal at lists.osgeo.org>
> *Subject:* Re: [pdal] libLAS to PDAL, how to write a LAS header from
> scratch in PDAL?
>
> Hi Mathieu,
>
> You don't need to do anything. PDAL will write a LAS file with a properly
> constructed header. You can use options on the LAS writers if you want to
> alter some of the header field data.
>
> On Tue, Aug 31, 2021 at 9:04 AM Mathieu Poulin <
> mathieu.poulin at mvtgeosolutions.com> wrote:
>
> Hello everyone,
>
> I am transitionning to PDAL from libLAS and so far almost everything has
> been easy to figure out. There is however one thing that I can not find any
> instructions on how to do, and that is how to write a LAS header in PDAL.
>
> I've asked the question on Stackoverflow before finding this mailing list,
> so here is a link to it:
> https://stackoverflow.com/questions/68986302/writing-las-header-with-pdal-in-c.
> Hopefully, someone here has the answer that I am looking for.
>
> Thanks in advance,
>
>  - Mathieu Poulin
>
> <https://stackoverflow.com/questions/68986302/writing-las-header-with-pdal-in-c>
> Writing LAS header with PDAL in C++ - Stack Overflow
> <https://stackoverflow.com/questions/68986302/writing-las-header-with-pdal-in-c>
> I am working on an application that writes LAS files from scratch based on
> lidar data. Previously, the application was built with LibLAS and it worked
> quite well. However, LibLAS has been discontin...
> stackoverflow.com
> **
>
> _______________________________________________
> pdal mailing list
> pdal at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/pdal
>
>
>
> --
> Andrew Bell
> andrew.bell.ia at gmail.com
> _______________________________________________
> pdal mailing list
> pdal at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/pdal
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/pdal/attachments/20210902/582399d7/attachment.html>


More information about the pdal mailing list