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

Andrew Bell andrew.bell.ia at gmail.com
Thu Sep 2 08:18:17 PDT 2021


On Thu, Sep 2, 2021 at 10: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.
>

PDAL automatically sets the bounds for the data. You don't need to do
anything.  You're getting the error because your data, when transformed
according to the scale/offset, doesn't fit in a 32-bit integer.  I'm not
sure why you were able to write your data using the other library --
perhaps the data wasn't being written properly or was invalid in some
cases? You should reduce the precision or set the offset in order to write
valid data. Take note of the defaults used for scale_<x/y/z> and
offset<x/y/z> and set them for your data or use the option
forward="scale,offset" if you want the output file to have the same
scale/offset as the input file (assuming there's just one input file).

min_x and max_x are only applicable to the crop filter and not the LAS
writer.

-- 
Andrew Bell
andrew.bell.ia at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/pdal/attachments/20210902/9c2450c1/attachment-0001.html>


More information about the pdal mailing list