Skip to content

Commit

Permalink
sort based on GPStime for COPC output (#94)
Browse files Browse the repository at this point in the history
  • Loading branch information
hobu authored Nov 29, 2021
1 parent c28d537 commit 6421a7f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
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");

This comment has been minimized.

Copy link
@abellgithub

abellgithub Jan 6, 2022

Collaborator

@hobu: Do you remember why you made this change?

This comment has been minimized.

Copy link
@hobu

hobu Jan 6, 2022

Author Collaborator

I think it is because we couldn't write COPC files with LASzip

This comment has been minimized.

Copy link
@abellgithub

abellgithub Jan 6, 2022

Collaborator

This code only runs when we do EPT output.

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))
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

0 comments on commit 6421a7f

Please sign in to comment.