[pdal] entwine error with PDAL with lasperf and no laszip

Jim Klassen klassen.js at gmail.com
Tue Jan 11 13:30:03 PST 2022



On 1/11/22 10:11, Howard Butler wrote:
> 
> 
>> On Jan 11, 2022, at 9:50 AM, Jim Klassen <klassen.js at gmail.com> wrote:
>>
>> If PDAL is built with lasperf but without laszip then entwine gives the error:
>>
>>     Exception in pool task: writers.las: Can't write LAZ output. PDAL not built with LASzip.
>>
>> Tested with entwine commit cd22b9f843badcbd236999c7dd75400a7237c0df   Thu Sep 23 14:58:28 2021 -0500
>>
>> The following patch "fixes" it but is less than ideal because then it requires lasperf.  Maybe using "compression": "true" would be better to let PDAL pick the implementation?  Or maybe choosing based on cmake settings?
>>
>> diff --git a/entwine/io/laszip.cpp b/entwine/io/laszip.cpp
>> index a94d0e2..ea90be4 100644
>> --- a/entwine/io/laszip.cpp
>> +++ b/entwine/io/laszip.cpp
>> @@ -56,7 +56,7 @@ void write(
>>      options.add("minor_version", 2);
>>      options.add("extra_dims", "all");
>>      options.add("software_id", "Entwine " + currentEntwineVersion().toString());
>> -    options.add("compression", "laszip");
>> +    options.add("compression", "lasperf");
>>      options.add("dataformat_id", timeMask | colorMask);
>>       const auto so = getScaleOffset(metadata.schema);
> 
> A better fix would be for Entwine to use pdal::Config::hasFeature(Feature::LAZPERF) to condition this.
> 
> 
> 

Thanks!  Is it worth checking for Feature::LASZIP too and failing out somehow if neither are available or just leaving the current behavior in place?

Should I make a PR?


diff --git a/entwine/io/laszip.cpp b/entwine/io/laszip.cpp
index ea90be4..20b8ffd 100644
--- a/entwine/io/laszip.cpp
+++ b/entwine/io/laszip.cpp
@@ -14,6 +14,7 @@
  #include <pdal/io/BufferReader.hpp>
  #include <pdal/io/LasReader.hpp>
  #include <pdal/io/LasWriter.hpp>
+#include <pdal/pdal_config.hpp>
  
  #include <entwine/types/metadata.hpp>
  #include <entwine/util/io.hpp>
@@ -56,7 +57,11 @@ void write(
      options.add("minor_version", 2);
      options.add("extra_dims", "all");
      options.add("software_id", "Entwine " + currentEntwineVersion().toString());
-    options.add("compression", "lasperf");
+    if (pdal::Config::hasFeature(pdal::Config::Feature::LAZPERF)) {
+        options.add("compression", "lazperf");
+    } else {
+        options.add("compression", "laszip");
+    }
      options.add("dataformat_id", timeMask | colorMask);
  
      const auto so = getScaleOffset(metadata.schema);




More information about the pdal mailing list