Skip to content

Commit

Permalink
Pass nosrs to las reader to prevent crashing on some incorrectly se…
Browse files Browse the repository at this point in the history
…t 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
  • Loading branch information
harveybia authored Jun 3, 2024
1 parent 2f29863 commit e870d64
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 1 deletion.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions epf/Epf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -285,11 +285,14 @@ void Epf::createFileInfos(const StringList& input, std::vector<FileInfo>& 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<FileInfo>& infos = processLas(*dynamic_cast<LasReader *>(s), fi);
Expand Down
1 change: 1 addition & 0 deletions epf/EpfTypes.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ struct FileInfo

std::string filename;
std::string driver;
bool no_srs;
DimInfoList dimInfo;
uint64_t numPoints;
uint64_t start;
Expand Down
2 changes: 2 additions & 0 deletions epf/FileProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions untwine/Common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ struct Options
StringList dimNames;
bool stats;
std::string a_srs;
bool no_srs;
bool metadata;
bool dummy;
};
Expand Down
2 changes: 2 additions & 0 deletions untwine/Untwine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit e870d64

Please sign in to comment.