From e870d64aca5e0c4271132a25bb35af655ede0283 Mon Sep 17 00:00:00 2001 From: Haowen Shi Date: Mon, 3 Jun 2024 07:16:43 -0700 Subject: [PATCH] Pass `nosrs` to las reader to prevent crashing on some incorrectly set global encoding WKT flag (#164) * Added options passthrough for readers.las.nosrs * Also specify nosrs to the FileProcessor * Make no_srs only applicable to las readers --- README.md | 6 +++++- epf/Epf.cpp | 3 +++ epf/EpfTypes.hpp | 1 + epf/FileProcessor.cpp | 2 ++ untwine/Common.hpp | 1 + untwine/Untwine.cpp | 2 ++ 6 files changed, 14 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 0a3ba97..1886ae4 100644 --- a/README.md +++ b/README.md @@ -61,7 +61,11 @@ Options - a_srs Assign an output SRS. Example `--a_srs EPSG:2056` - + +- no_srs + + Don't read the SLR VLRs. This is only applicable to las files. [Default: false] + - dims List of dimensions to load. X, Y and Z are always loaded. Limiting the dimensions can diff --git a/epf/Epf.cpp b/epf/Epf.cpp index 0563b3d..3d98a8e 100644 --- a/epf/Epf.cpp +++ b/epf/Epf.cpp @@ -285,11 +285,14 @@ void Epf::createFileInfos(const StringList& input, std::vector& fileIn pdal::Options opts; opts.add("filename", filename); + if (driver == "readers.las") + opts.add("nosrs", m_b.opts.no_srs); s->setOptions(opts); FileInfo fi; fi.filename = filename; fi.driver = driver; + fi.no_srs = m_b.opts.no_srs; if (driver == "readers.las") { const std::vector& infos = processLas(*dynamic_cast(s), fi); diff --git a/epf/EpfTypes.hpp b/epf/EpfTypes.hpp index 879876d..3d40df6 100644 --- a/epf/EpfTypes.hpp +++ b/epf/EpfTypes.hpp @@ -48,6 +48,7 @@ struct FileInfo std::string filename; std::string driver; + bool no_srs; DimInfoList dimInfo; uint64_t numPoints; uint64_t start; diff --git a/epf/FileProcessor.cpp b/epf/FileProcessor.cpp index e1db409..e9c977c 100644 --- a/epf/FileProcessor.cpp +++ b/epf/FileProcessor.cpp @@ -133,6 +133,8 @@ void FileProcessor::run() pdal::Options opts; opts.add("filename", m_fi.filename); opts.add("count", m_fi.numPoints); + if (m_fi.driver == "readers.las") + opts.add("nosrs", m_fi.no_srs); #ifdef PDAL_LAS_START if (m_fi.driver == "readers.las") opts.add("start", m_fi.start); diff --git a/untwine/Common.hpp b/untwine/Common.hpp index 63efa29..0fb7776 100644 --- a/untwine/Common.hpp +++ b/untwine/Common.hpp @@ -49,6 +49,7 @@ struct Options StringList dimNames; bool stats; std::string a_srs; + bool no_srs; bool metadata; bool dummy; }; diff --git a/untwine/Untwine.cpp b/untwine/Untwine.cpp index ce316c6..ddd5a0c 100644 --- a/untwine/Untwine.cpp +++ b/untwine/Untwine.cpp @@ -49,6 +49,8 @@ void addArgs(pdal::ProgramArgs& programArgs, Options& options, pdal::Arg * &temp options.a_srs, ""); programArgs.add("metadata", "Write PDAL metadata to VLR output", options.metadata, false); + programArgs.add("no_srs", "PDAL readers.las.nosrs passthrough.", + options.no_srs, false); } bool handleOptions(pdal::StringList& arglist, Options& options)