Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support LAS start #61

Merged
merged 1 commit into from
Jul 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 31 additions & 1 deletion epf/Epf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

#include <unordered_set>

#include <pdal/pdal_features.hpp>
#include <pdal/Dimension.hpp>
#include <pdal/PointLayout.hpp>
#include <pdal/StageFactory.hpp>
Expand Down Expand Up @@ -185,6 +186,7 @@ PointCount Epf::createFileInfo(const StringList& input, StringList dimNames,
{
using namespace pdal;

std::vector<FileInfo> tempFileInfos;
std::vector<std::string> filenames;
PointCount totalPoints = 0;

Expand Down Expand Up @@ -247,13 +249,41 @@ PointCount Epf::createFileInfo(const StringList& input, StringList dimNames,
std::cerr << "Files have mismatched SRS values. Using SRS from '" <<
m_srsFileInfo.filename << "'.\n";
fi.srs = qi.m_srs;
fileInfos.push_back(fi);
tempFileInfos.push_back(fi);
if (!m_srsFileInfo.valid() && qi.m_srs.valid())
m_srsFileInfo = fi;

m_grid.expand(qi.m_bounds, qi.m_pointCount);
totalPoints += fi.numPoints;
}


#ifdef PDAL_LAS_START
PointCount ChunkSize = 5000000;
for (const FileInfo& fi : tempFileInfos)
{
if (fi.driver != "readers.las" || fi.numPoints < ChunkSize)
{
fileInfos.push_back(fi);
continue;
}
PointCount remaining = fi.numPoints;
pdal::PointId start = 0;
while (remaining)
{
FileInfo lasFi(fi);
lasFi.numPoints = (std::min)(ChunkSize, remaining);
lasFi.start = start;
fileInfos.push_back(lasFi);

start += ChunkSize;
remaining -= lasFi.numPoints;
}
}
#else
fileInfos = std::move(tempFileInfos);
#endif

return totalPoints;
}

Expand Down
4 changes: 4 additions & 0 deletions epf/EpfTypes.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,14 @@ constexpr int NumFileProcessors = 8;

struct FileInfo
{
FileInfo() : numPoints(0), start(0)
{}

std::string filename;
std::string driver;
DimInfoList dimInfo;
uint64_t numPoints;
uint64_t start;
pdal::BOX3D bounds;
pdal::SpatialReference srs;

Expand Down
7 changes: 7 additions & 0 deletions epf/FileProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include "FileProcessor.hpp"
#include "../untwine/ProgressWriter.hpp"

#include <pdal/pdal_features.hpp>
#include <pdal/StageFactory.hpp>
#include <pdal/filters/StreamCallbackFilter.hpp>

Expand All @@ -29,8 +30,14 @@ FileProcessor::FileProcessor(const FileInfo& fi, size_t pointSize, const Grid& g

void FileProcessor::run()
{

pdal::Options opts;
opts.add("filename", m_fi.filename);
opts.add("count", m_fi.numPoints);
#ifdef PDAL_LAS_START
if (m_fi.driver == "readers.las")
opts.add("start", m_fi.start);
#endif

pdal::StageFactory factory;
pdal::Stage *s = factory.createStage(m_fi.driver);
Expand Down