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

sort based on GPStime for COPC output #94

Merged
merged 1 commit into from
Nov 29, 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
19 changes: 18 additions & 1 deletion bu/Processor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ void Processor::writeEptFile(const std::string& filename, pdal::PointTableRef ta
pdal::Options wopts;
wopts.add("extra_dims", "all");
wopts.add("software_id", "Entwine 1.0");
wopts.add("compression", "laszip");
wopts.add("compression", "lazperf");
wopts.add("filename", filename);
wopts.add("offset_x", m_b.offset[0]);
wopts.add("offset_y", m_b.offset[1]);
Expand All @@ -470,6 +470,19 @@ void Processor::writeEptFile(const std::string& filename, pdal::PointTableRef ta
w->execute(table);
}

void Processor::sortChunk(const VoxelKey& key, pdal::PointViewPtr view)
{

using namespace pdal;
auto cmp = [](const PointRef& p1, const PointRef& p2)
{
bool result = p1.compare(pdal::Dimension::Id::GpsTime, p2);
return result;
};

std::stable_sort(view->begin(), view->end(), cmp);

}
void Processor::createChunk(const VoxelKey& key, pdal::PointViewPtr view)
{
using namespace pdal;
Expand All @@ -480,7 +493,11 @@ void Processor::createChunk(const VoxelKey& key, pdal::PointViewPtr view)
return;
}

if (view->layout()->hasDim(Dimension::Id::GpsTime))
hobu marked this conversation as resolved.
Show resolved Hide resolved
sortChunk(key, view);

PointLayoutPtr layout = view->layout();

int ebCount {0};
for (DimType dim : m_extraDims)
ebCount += layout->dimSize(dim.m_id);
Expand Down
1 change: 1 addition & 0 deletions bu/Processor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ class Processor
void writeEptFile(const std::string& filename, pdal::PointTableRef table,
pdal::PointViewPtr view);
void createChunk(const VoxelKey& key, pdal::PointViewPtr view);
void sortChunk(const VoxelKey& key, pdal::PointViewPtr view);
void fillPointBuf(pdal::PointRef& point, std::vector<char>& buf);

VoxelInfo m_vi;
Expand Down