Skip to content
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ This will create a grid for each data file separately in parallel and then merge
pdal_wrench density --input=hello.vpc --resolution=1 --output=density.tif
```

When algorithms create derived VPCs, by default they use uncompressed LAS, but `--output-format=laz` option can switch to compressed LAZ.
When algorithms create derived VPCs, by default they use COPC, but argument `--vpc-output-format=las` (allowed values are `las`, `laz`, `copc`) can be used to switch to LAS, LAZ or COPC. COPC format is preferred so that tools like QGIS can immediately view the data, the conversion to COPC format takes time so the operation will be slower. If multiple operations are to be run one after the other, it may be better to use LAS or LAZ format for intermediate VPCs for faster processing.

## VPC support in algorithms

Expand Down
24 changes: 12 additions & 12 deletions src/alg.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,12 +116,12 @@ struct Translate : public Alg
std::string assignCrs;
std::string transformCrs;
std::string transformCoordOp;
std::string outputFormat; // las / laz / copc
std::string outputFormatVpc; // las / laz / copc
std::string transformMatrix; // 4x4 matrix as 16 space-separated values

// args - initialized in addArgs()
pdal::Arg* argOutput = nullptr;
pdal::Arg* argOutputFormat = nullptr;
pdal::Arg* argOutputFormatVpc = nullptr;

std::vector<std::string> tileOutputFiles;

Expand Down Expand Up @@ -187,11 +187,11 @@ struct Clip : public Alg
// parameters from the user
std::string outputFile;
std::string polygonFile;
std::string outputFormat; // las / laz / copc
std::string outputFormatVpc; // las / laz / copc

// args - initialized in addArgs()
pdal::Arg* argOutput = nullptr;
pdal::Arg* argOutputFormat = nullptr;
pdal::Arg* argOutputFormatVpc = nullptr;
pdal::Arg* argPolygon = nullptr;

std::vector<std::string> tileOutputFiles;
Expand Down Expand Up @@ -235,14 +235,14 @@ struct Thin : public Alg
std::string mode; // "every-nth" or "sample"
int stepEveryN; // keep every N-th point
double stepSample; // cell size for Poisson sampling
std::string outputFormat; // las / laz / copc
std::string outputFormatVpc; // las / laz / copc

// args - initialized in addArgs()
pdal::Arg* argOutput = nullptr;
pdal::Arg* argMode = nullptr;
pdal::Arg* argStepEveryN = nullptr;
pdal::Arg* argStepSample = nullptr;
pdal::Arg* argOutputFormat = nullptr;
pdal::Arg* argOutputFormatVpc = nullptr;

std::vector<std::string> tileOutputFiles;

Expand Down Expand Up @@ -342,7 +342,7 @@ struct ClassifyGround : public Alg

// parameters from the user
std::string outputFile;
std::string outputFormat; // las / laz / copc
std::string outputFormatVpc; // las / laz / copc

double cellSize = 1.0;
double scalar = 1.25;
Expand All @@ -352,7 +352,7 @@ struct ClassifyGround : public Alg

// args - initialized in addArgs()
pdal::Arg* argOutput = nullptr;
pdal::Arg* argOutputFormat = nullptr;
pdal::Arg* argOutputFormatVpc = nullptr;
pdal::Arg* argCellSize = nullptr;

pdal::Arg* argScalar = nullptr;
Expand All @@ -379,7 +379,7 @@ struct FilterNoise: public Alg

// parameters from the user
std::string outputFile;
std::string outputFormat; // las / laz / copc
std::string outputFormatVpc; // las / laz / copc
std::string algorithm = "statistical"; // "statistical" or "radius"
bool removeNoisePoints = false;

Expand All @@ -393,7 +393,7 @@ struct FilterNoise: public Alg

// args - initialized in addArgs()
pdal::Arg* argOutput = nullptr;
pdal::Arg* argOutputFormat = nullptr;
pdal::Arg* argOutputFormatVpc = nullptr;
pdal::Arg* argAlgorithm = nullptr;
pdal::Arg* argRemoveNoisePoints = nullptr;
pdal::Arg* argRadiusMinK = nullptr;
Expand All @@ -415,7 +415,7 @@ struct HeightAboveGround : public Alg

// parameters from the user
std::string outputFile;
std::string outputFormat; // las / laz / copc / vpc
std::string outputFormatVpc; // las / laz / copc
bool replaceZWithHeightAboveGround = true;
std::string algorithm = "nn";

Expand All @@ -428,7 +428,7 @@ struct HeightAboveGround : public Alg

// args - initialized in addArgs()
pdal::Arg* argOutput = nullptr;
pdal::Arg* argOutputFormat = nullptr;
pdal::Arg* argOutputFormatVpc = nullptr;
pdal::Arg* argReplaceZWithHeightAboveGround = nullptr;
pdal::Arg* argAlgorithm = nullptr;

Expand Down
26 changes: 11 additions & 15 deletions src/classify_ground.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ namespace fs = std::filesystem;
void ClassifyGround::addArgs()
{
argOutput = &programArgs.add("output,o", "Output point cloud file", outputFile);
argOutputFormat = &programArgs.add("output-format", "Output format (las/laz/copc)", outputFormat);
argOutputFormatVpc = &programArgs.add("vpc-output-format", "Output format (las/laz/copc)", outputFormatVpc, "copc");

argCellSize = &programArgs.add("cell-size", "Sets the grid cell size in map units. Smaller values give finer detail but may increase noise.", cellSize, 1.0);
argScalar = &programArgs.add("scalar", "Increases the threshold on steeper slopes. Raise this for rough terrain.", scalar, 1.25);
Expand All @@ -52,17 +52,20 @@ bool ClassifyGround::checkArgs()
return false;
}

if (argOutputFormat->set())
if (argOutputFormatVpc->set())
{
if (outputFormat != "las" && outputFormat != "laz" && outputFormat != "copc")
if (outputFormatVpc != "las" && outputFormatVpc != "laz" && outputFormatVpc != "copc")
{
std::cerr << "unknown output format: " << outputFormat << std::endl;
std::cerr << "unknown output format: " << outputFormatVpc << std::endl;
return false;
}
}
else
outputFormat = "las"; // uncompressed by default


if ( ends_with(outputFile, ".vpc") && outputFormatVpc == "copc" )
{
isStreaming = false;
}

return true;
}

Expand Down Expand Up @@ -134,14 +137,7 @@ void ClassifyGround::preparePipelines(std::vector<std::unique_ptr<PipelineManage
ParallelJobInfo tile(ParallelJobInfo::FileBased, BOX2D(), filterExpression, filterBounds);
tile.inputFilenames.push_back(f.filename);

// 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 = fileStem(f.filename);

if (!ends_with(outputFile, ".vpc"))
tile.outputFilename = (outputSubdir / inputBasename).string() + ".las";
else
tile.outputFilename = (outputSubdir / inputBasename).string() + "." + outputFormat;
tile.outputFilename = tileOutputFileName(outputFile, outputFormatVpc, outputSubdir, f.filename);

tileOutputFiles.push_back(tile.outputFilename);

Expand Down
25 changes: 10 additions & 15 deletions src/clip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ namespace fs = std::filesystem;
void Clip::addArgs()
{
argOutput = &programArgs.add("output,o", "Output point cloud file", outputFile);
argOutputFormat = &programArgs.add("output-format", "Output format (las/laz/copc)", outputFormat);
argOutputFormatVpc = &programArgs.add("vpc-output-format", "Output format (las/laz/copc)", outputFormatVpc, "copc");
argPolygon = &programArgs.add("polygon,p", "Input polygon vector file", polygonFile);
}

Expand All @@ -51,17 +51,20 @@ bool Clip::checkArgs()
return false;
}

if (argOutputFormat->set())
if (argOutputFormatVpc->set())
{
if (outputFormat != "las" && outputFormat != "laz")
if (outputFormatVpc != "las" && outputFormatVpc != "laz" && outputFormatVpc != "copc")
{
std::cerr << "unknown output format: " << outputFormat << std::endl;
std::cerr << "unknown output format: " << outputFormatVpc << std::endl;
return false;
}
}
else
outputFormat = "las"; // uncompressed by default

if ( ends_with(outputFile, ".vpc") && outputFormatVpc == "copc" )
{
isStreaming = false;
}

return true;
}

Expand Down Expand Up @@ -187,15 +190,7 @@ void Clip::preparePipelines(std::vector<std::unique_ptr<PipelineManager>>& pipel
ParallelJobInfo tile(ParallelJobInfo::FileBased, BOX2D(), filterExpression, filterBounds);
tile.inputFilenames.push_back(f.filename);

// 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 = 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"))
tile.outputFilename = (outputSubdir / inputBasename).string() + ".las";
else
tile.outputFilename = (outputSubdir / inputBasename).string() + "." + outputFormat;
tile.outputFilename = tileOutputFileName(outputFile, outputFormatVpc, outputSubdir, f.filename);

tileOutputFiles.push_back(tile.outputFilename);

Expand Down
24 changes: 10 additions & 14 deletions src/filter_noise.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ namespace fs = std::filesystem;
void FilterNoise::addArgs()
{
argOutput = &programArgs.add("output,o", "Output point cloud file", outputFile);
argOutputFormat = &programArgs.add("output-format", "Output format (las/laz/copc)", outputFormat);
argOutputFormatVpc = &programArgs.add("vpc-output-format", "Output format (las/laz/copc)", outputFormatVpc, "copc");

argAlgorithm = &programArgs.add("algorithm", "Noise filtering algorithm to use: statistical or radius.", algorithm, "statistical");
argRemoveNoisePoints = &programArgs.add("remove-noise-points", "Remove noise points from the output.", removeNoisePoints, false);
Expand All @@ -56,16 +56,19 @@ bool FilterNoise::checkArgs()
return false;
}

if (argOutputFormat->set())
if (argOutputFormatVpc->set())
{
if (outputFormat != "las" && outputFormat != "laz" && outputFormat != "copc")
if (outputFormatVpc != "las" && outputFormatVpc != "laz" && outputFormatVpc != "copc")
{
std::cerr << "unknown output format: " << outputFormat << std::endl;
std::cerr << "unknown output format: " << outputFormatVpc << std::endl;
return false;
}
}
else
outputFormat = "las"; // uncompressed by default

if ( ends_with(outputFile, ".vpc") && outputFormatVpc == "copc" )
{
isStreaming = false;
}

if (!argAlgorithm->set())
{
Expand Down Expand Up @@ -177,14 +180,7 @@ void FilterNoise::preparePipelines(std::vector<std::unique_ptr<PipelineManager>>
ParallelJobInfo tile(ParallelJobInfo::FileBased, BOX2D(), filterExpression, filterBounds);
tile.inputFilenames.push_back(f.filename);

// 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 = fileStem(f.filename);

if (!ends_with(outputFile, ".vpc"))
tile.outputFilename = (outputSubdir / inputBasename).string() + ".las";
else
tile.outputFilename = (outputSubdir / inputBasename).string() + "." + outputFormat;
tile.outputFilename = tileOutputFileName(outputFile, outputFormatVpc, outputSubdir, f.filename);

tileOutputFiles.push_back(tile.outputFilename);

Expand Down
24 changes: 10 additions & 14 deletions src/height_above_ground.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ namespace fs = std::filesystem;
void HeightAboveGround::addArgs()
{
argOutput = &programArgs.add("output,o", "Output point cloud file", outputFile);
argOutputFormat = &programArgs.add("output-format", "Output format (las/laz/copc)", outputFormat);
argOutputFormatVpc = &programArgs.add("vpc-output-format", "Output format (las/laz/copc)", outputFormatVpc, "copc");
argAlgorithm = &programArgs.add("algorithm", "Height Above Ground algorithm to use: nn (Nearest Neighbor) or delaunay (Delaunay).", algorithm, "nn");
argReplaceZWithHeightAboveGround = &programArgs.add("replace-z", "Replace Z dimension with height above ground (true/false).", replaceZWithHeightAboveGround, true);

Expand All @@ -55,17 +55,20 @@ bool HeightAboveGround::checkArgs()
return false;
}

if (argOutputFormat->set())
if (argOutputFormatVpc->set())
{
if (outputFormat != "las" && outputFormat != "laz" && outputFormat != "copc")
if (outputFormatVpc != "las" && outputFormatVpc != "laz" && outputFormatVpc != "copc")
{
std::cerr << "unknown output format: " << outputFormat << std::endl;
std::cerr << "unknown output format: " << outputFormatVpc << std::endl;
return false;
}
}
else
outputFormat = "las"; // uncompressed by default

if ( ends_with(outputFile, ".vpc") && outputFormatVpc == "copc" )
{
isStreaming = false;
}

if (!argAlgorithm->set())
{
std::cerr << "missing algorithm" << std::endl;
Expand Down Expand Up @@ -193,14 +196,7 @@ void HeightAboveGround::preparePipelines(std::vector<std::unique_ptr<PipelineMan
ParallelJobInfo tile(ParallelJobInfo::FileBased, BOX2D(), filterExpression, filterBounds);
tile.inputFilenames.push_back(f.filename);

// 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 = fileStem(f.filename);

if (!ends_with(outputFile, ".vpc"))
tile.outputFilename = (outputSubdir / inputBasename).string() + ".las";
else
tile.outputFilename = (outputSubdir / inputBasename).string() + "." + outputFormat;
tile.outputFilename = tileOutputFileName(outputFile, outputFormatVpc, outputSubdir, f.filename);

tileOutputFiles.push_back(tile.outputFilename);

Expand Down
2 changes: 1 addition & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

extern int runTile(std::vector<std::string> arglist); // tile/tile.cpp

std::string WRENCH_VERSION = "1.3.0";
std::string WRENCH_VERSION = "1.3.1";

void printUsage()
{
Expand Down
24 changes: 10 additions & 14 deletions src/thin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ namespace fs = std::filesystem;
void Thin::addArgs()
{
argOutput = &programArgs.add("output,o", "Output point cloud file", outputFile);
argOutputFormat = &programArgs.add("output-format", "Output format (las/laz/copc)", outputFormat);
argOutputFormatVpc = &programArgs.add("vpc-output-format", "Output format (las/laz/copc)", outputFormatVpc, "copc");
argMode = &programArgs.add("mode", " 'every-nth' or 'sample' - either to keep every N-th point or to keep points based on their distance", mode);
argStepEveryN = &programArgs.add("step-every-nth", "Keep every N-th point", stepEveryN);
argStepSample = &programArgs.add("step-sample", "Minimum spacing between points", stepSample);
Expand Down Expand Up @@ -78,17 +78,20 @@ bool Thin::checkArgs()
return false;
}

if (argOutputFormat->set())
if (argOutputFormatVpc->set())
{
if (outputFormat != "las" && outputFormat != "laz")
if (outputFormatVpc != "las" && outputFormatVpc != "laz" && outputFormatVpc != "copc")
{
std::cerr << "unknown output format: " << outputFormat << std::endl;
std::cerr << "unknown output format: " << outputFormatVpc << std::endl;
return false;
}
}
else
outputFormat = "las"; // uncompressed by default

if ( ends_with(outputFile, ".vpc") && outputFormatVpc == "copc" )
{
isStreaming = false;
}

return true;
}

Expand Down Expand Up @@ -163,14 +166,7 @@ void Thin::preparePipelines(std::vector<std::unique_ptr<PipelineManager>>& pipel
ParallelJobInfo tile(ParallelJobInfo::FileBased, BOX2D(), filterExpression, filterBounds);
tile.inputFilenames.push_back(f.filename);

// 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 = fileStem(f.filename);

if (!ends_with(outputFile, ".vpc"))
tile.outputFilename = (outputSubdir / inputBasename).string() + ".las";
else
tile.outputFilename = (outputSubdir / inputBasename).string() + "." + outputFormat;
tile.outputFilename = tileOutputFileName(outputFile, outputFormatVpc, outputSubdir, f.filename);

tileOutputFiles.push_back(tile.outputFilename);

Expand Down
2 changes: 1 addition & 1 deletion src/tile/tile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ void addArgs(pdal::ProgramArgs& programArgs, BaseInfo::Options& options, pdal::A
programArgs.add("input-file-list", "Read input files from a text file", options.inputFileList);
programArgs.add("length,l", "Tile length", options.tileLength, 1000.);
tempArg = &(programArgs.add("temp_dir", "Temp directory", options.tempDir));
programArgs.add("output-format", "Output format (las/laz)", options.outputFormat);
programArgs.add("vpc-output-format", "Output format (las/laz/copc)", options.outputFormat);

// for debugging
programArgs.add("preserve_temp_dir", "Do not remove the temp directory before and after processing (for debugging)",
Expand Down
Loading
Loading