update wrench

This commit is contained in:
Jan Caha 2025-07-03 14:11:47 +02:00 committed by Martin Dobias
parent 8f5e635e97
commit a26b91b364
7 changed files with 33 additions and 5 deletions

View File

@ -173,3 +173,15 @@ void removeFiles(const std::vector<std::string> &tileOutputFiles, bool removePar
fs::remove(outputDir);
}
}
fs::path fileStem(const std::string &filename)
{
fs::path inputBasename = fs::path(filename).stem();
while(inputBasename.has_extension())
{
inputBasename = inputBasename.stem();
}
return inputBasename;
}

View File

@ -93,6 +93,8 @@ bool runAlg(std::vector<std::string> args, Alg &alg);
void removeFiles(const std::vector<std::string> &tileOutputFiles, bool removeParentDirIfEmpty = true);
fs::path fileStem(const std::string &filename);
//////////////

View File

@ -191,7 +191,7 @@ void Clip::preparePipelines(std::vector<std::unique_ptr<PipelineManager>>& pipel
// for input file /x/y/z.las that goes to /tmp/hello.vpc,
// individual output file will be called /tmp/hello/z.las
fs::path inputBasename = fs::path(f.filename).stem();
fs::path inputBasename = fileStem(f.filename);
// if the output is not VPC las file format is forced to avoid time spent on compression, files will be later merged into single output and removed anyways
if (!ends_with(outputFile, ".vpc"))

View File

@ -99,6 +99,18 @@ static std::unique_ptr<PipelineManager> pipeline(ParallelJobInfo *tile)
last.push_back(filterExpr);
}
// this is a special case for merging COPC files
// writers.copc does not support multiple inputs
// merge step is necessary before writing the output
if (ends_with(tile->outputFilename, ".copc.laz"))
{
Stage *merge = &manager->makeFilter("filters.merge");
for (Stage *stage : last)
merge->setInput(*stage);
last.clear();
last.push_back(merge);
}
pdal::Options options;
options.add(pdal::Option("forward", "all"));
Stage* writer = &manager->makeWriter(tile->outputFilename, "", options);
@ -138,8 +150,10 @@ void Merge::preparePipelines(std::vector<std::unique_ptr<PipelineManager>>& pipe
VirtualPointCloud vpc;
if (!vpc.read(inputFile))
{
std::cerr << "could not open input VPC: " << inputFile << std::endl;
return;
}
for (const VirtualPointCloud::File& vpcSingleFile : vpc.files)
{

View File

@ -167,7 +167,7 @@ void Thin::preparePipelines(std::vector<std::unique_ptr<PipelineManager>>& pipel
// for input file /x/y/z.las that goes to /tmp/hello.vpc,
// individual output file will be called /tmp/hello/z.las
fs::path inputBasename = fs::path(f.filename).stem();
fs::path inputBasename = fileStem(f.filename);
if (!ends_with(outputFile, ".vpc"))
tile.outputFilename = (outputSubdir / inputBasename).string() + ".las";

View File

@ -112,7 +112,7 @@ void ToVector::preparePipelines(std::vector<std::unique_ptr<PipelineManager>>& p
// for input file /x/y/z.las that goes to /tmp/hello.vpc,
// individual output file will be called /tmp/hello/z.las
fs::path inputBasename = fs::path(f.filename).stem();
fs::path inputBasename = fileStem(f.filename);
tile.outputFilename = (outputSubdir / inputBasename).string() + ".gpkg";
tileOutputFiles.push_back(tile.outputFilename);

View File

@ -169,12 +169,12 @@ void Translate::preparePipelines(std::vector<std::unique_ptr<PipelineManager>>&
// for input file /x/y/z.las that goes to /tmp/hello.vpc,
// individual output file will be called /tmp/hello/z.las
fs::path inputBasename = fs::path(f.filename).stem();
fs::path inputBasename = fileStem(f.filename);
if (!ends_with(outputFile, ".vpc"))
tile.outputFilename = (outputSubdir / inputBasename).string() + ".las";
else
tile.outputFilename = (outputSubdir / inputBasename).string() + outputFormat;
tile.outputFilename = (outputSubdir / inputBasename).string() + "." + outputFormat;
tileOutputFiles.push_back(tile.outputFilename);