Skip to content
Open
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: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ set (PEDANTIC TRUE CACHE BOOL "Determines if we should compile in pedantic mode.
find_package(PDAL REQUIRED)
find_package(GDAL REQUIRED)
find_package(Threads REQUIRED)
find_package(libzip REQUIRED)

add_executable(pdal_wrench
src/main.cpp
Expand Down Expand Up @@ -55,6 +56,7 @@ target_link_libraries(pdal_wrench
${PDAL_LIBRARIES}
${GDAL_LIBRARY}
${CMAKE_THREAD_LIBS_INIT}
libzip::zip
)

install(TARGETS pdal_wrench DESTINATION bin)
Expand Down
1 change: 1 addition & 0 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ dependencies:
- ninja
- cmake
- pdal
- libzip

4 changes: 2 additions & 2 deletions src/alg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ bool runAlg(std::vector<std::string> args, Alg &alg)

if (alg.hasSingleInput)
{
if (ends_with(alg.inputFile, ".vpc"))
if (isVpcFilename(alg.inputFile))
{
VirtualPointCloud vpc;
if (!vpc.read(alg.inputFile))
Expand Down Expand Up @@ -184,4 +184,4 @@ fs::path fileStem(const std::string &filename)
}

return inputBasename;
}
}
2 changes: 1 addition & 1 deletion src/boundary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ static std::unique_ptr<PipelineManager> pipeline(ParallelJobInfo *tile, double r

void Boundary::preparePipelines(std::vector<std::unique_ptr<PipelineManager>>& pipelines)
{
if (ends_with(inputFile, ".vpc"))
if (isVpcFilename(inputFile))
{
// VPC handling
VirtualPointCloud vpc;
Expand Down
6 changes: 3 additions & 3 deletions src/classify_ground.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ bool ClassifyGround::checkArgs()
}
}

if ( ends_with(outputFile, ".vpc") && outputFormatVpc == "copc" )
if ( isVpcFilename(outputFile) && outputFormatVpc == "copc" )
{
isStreaming = false;
}
Expand Down Expand Up @@ -120,7 +120,7 @@ void ClassifyGround::preparePipelines(std::vector<std::unique_ptr<PipelineManage
filterOptions.add(pdal::Option("window", windowSize));


if (ends_with(inputFile, ".vpc"))
if (isVpcFilename(inputFile))
{
// for /tmp/hello.vpc we will use /tmp/hello dir for all results
fs::path outputParentDir = fs::path(outputFile).parent_path();
Expand Down Expand Up @@ -160,4 +160,4 @@ void ClassifyGround::finalize(std::vector<std::unique_ptr<PipelineManager>>&)
return;

buildOutput(outputFile, tileOutputFiles);
}
}
4 changes: 2 additions & 2 deletions src/clip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ bool Clip::checkArgs()
}
}

if ( ends_with(outputFile, ".vpc") && outputFormatVpc == "copc" )
if ( isVpcFilename(outputFile) && outputFormatVpc == "copc" )
{
isStreaming = false;
}
Expand Down Expand Up @@ -162,7 +162,7 @@ void Clip::preparePipelines(std::vector<std::unique_ptr<PipelineManager>>& pipel
if (!loadPolygons(polygonFile, crop_opts, bbox))
return;

if (ends_with(inputFile, ".vpc"))
if (isVpcFilename(inputFile))
{
// for /tmp/hello.vpc we will use /tmp/hello dir for all results
fs::path outputParentDir = fs::path(outputFile).parent_path();
Expand Down
4 changes: 2 additions & 2 deletions src/compare.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@ void ComparePointClouds::addArgs()
bool ComparePointClouds::checkArgs()
{

if (ends_with(inputFile, ".vpc")) {
if (isVpcFilename(inputFile)) {
std::cerr << "input cannot be a VPC file" << std::endl;
return false;
}

if (ends_with(comparedInputFile, ".vpc")) {
if (isVpcFilename(comparedInputFile)) {
std::cerr << "compared input cannot be a VPC file" << std::endl;
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion src/density.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ std::unique_ptr<PipelineManager> Density::pipeline(ParallelJobInfo *tile) const

void Density::preparePipelines(std::vector<std::unique_ptr<PipelineManager>>& pipelines)
{
if (ends_with(inputFile, ".vpc"))
if (isVpcFilename(inputFile))
{
// using spatial processing

Expand Down
6 changes: 3 additions & 3 deletions src/filter_noise.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ bool FilterNoise::checkArgs()
}
}

if ( ends_with(outputFile, ".vpc") && outputFormatVpc == "copc" )
if ( isVpcFilename(outputFile) && outputFormatVpc == "copc" )
{
isStreaming = false;
}
Expand Down Expand Up @@ -163,7 +163,7 @@ void FilterNoise::preparePipelines(std::vector<std::unique_ptr<PipelineManager>>
noiseFilterOptions.add(pdal::Option("multiplier", statisticalMultiplier));
}

if (ends_with(inputFile, ".vpc"))
if (isVpcFilename(inputFile))
{
// for /tmp/hello.vpc we will use /tmp/hello dir for all results
fs::path outputParentDir = fs::path(outputFile).parent_path();
Expand Down Expand Up @@ -203,4 +203,4 @@ void FilterNoise::finalize(std::vector<std::unique_ptr<PipelineManager>>&)
return;

buildOutput(outputFile, tileOutputFiles);
}
}
4 changes: 2 additions & 2 deletions src/height_above_ground.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ bool HeightAboveGround::checkArgs()
}
}

if ( ends_with(outputFile, ".vpc") && outputFormatVpc == "copc" )
if ( isVpcFilename(outputFile) && outputFormatVpc == "copc" )
{
isStreaming = false;
}
Expand Down Expand Up @@ -179,7 +179,7 @@ static std::unique_ptr<PipelineManager> pipeline(ParallelJobInfo *tile, std::str

void HeightAboveGround::preparePipelines(std::vector<std::unique_ptr<PipelineManager>>& pipelines)
{
if (ends_with(inputFile, ".vpc"))
if (isVpcFilename(inputFile))
{
// for /tmp/hello.vpc we will use /tmp/hello dir for all results
fs::path outputParentDir = fs::path(outputFile).parent_path();
Expand Down
2 changes: 1 addition & 1 deletion src/info.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ static void formatCrsInfo(const std::string &crsWkt, std::string &crs, std::stri

void Info::preparePipelines(std::vector<std::unique_ptr<PipelineManager>>&)
{
if (ends_with(inputFile, ".vpc"))
if (isVpcFilename(inputFile))
{
VirtualPointCloud vpc;
if (!vpc.read(inputFile))
Expand Down
4 changes: 3 additions & 1 deletion src/merge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@ void Merge::preparePipelines(std::vector<std::unique_ptr<PipelineManager>>& pipe
{
ParallelJobInfo tile(ParallelJobInfo::Single, BOX2D(), filterExpression, filterBounds);
std::vector<std::string> inputFilesToProcess;
// move any input files to inputFilesToProcess, so they go through processInputFile()
std::swap(inputFilesToProcess, inputFiles);
if (!inputFileList.empty())
{
std::ifstream inputFile(inputFileList);
Expand All @@ -143,7 +145,7 @@ void Merge::preparePipelines(std::vector<std::unique_ptr<PipelineManager>>& pipe

std::function<void(const std::string& inputFile)> processInputFile;
processInputFile = [&processInputFile,this](const std::string& inputFile) {
if (ends_with(inputFile, ".vpc"))
if (isVpcFilename(inputFile))
{
VirtualPointCloud vpc;
if (!vpc.read(inputFile))
Expand Down
6 changes: 3 additions & 3 deletions src/thin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ bool Thin::checkArgs()
}
}

if ( ends_with(outputFile, ".vpc") && outputFormatVpc == "copc" )
if ( isVpcFilename(outputFile) && outputFormatVpc == "copc" )
{
isStreaming = false;
}
Expand Down Expand Up @@ -149,7 +149,7 @@ static std::unique_ptr<PipelineManager> pipeline(ParallelJobInfo *tile, std::str

void Thin::preparePipelines(std::vector<std::unique_ptr<PipelineManager>>& pipelines)
{
if (ends_with(inputFile, ".vpc"))
if (isVpcFilename(inputFile))
{
// for /tmp/hello.vpc we will use /tmp/hello dir for all results
fs::path outputParentDir = fs::path(outputFile).parent_path();
Expand Down Expand Up @@ -197,7 +197,7 @@ void Thin::finalize(std::vector<std::unique_ptr<PipelineManager>>&)
for (std::string f : tileOutputFiles)
args.push_back(f);

if (ends_with(outputFile, ".vpc"))
if (isVpcFilename(outputFile))
{
// now build a new output VPC
buildVpc(args);
Expand Down
4 changes: 2 additions & 2 deletions src/tile/tile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ static PointCount createFileInfo(const StringList& input, StringList dimNames,
std::vector<std::string> dirfiles = directoryList(filename);
filenames.insert(filenames.end(), dirfiles.begin(), dirfiles.end());
}
else if (ends_with(filename, ".vpc"))
else if (isVpcFilename(filename))
{
VirtualPointCloud vpc;
if (!vpc.read(filename))
Expand Down Expand Up @@ -474,7 +474,7 @@ bool handleOptions(pdal::StringList& arglist, BaseInfo::Options& options)
throw FatalError(err.what());
}

if (ends_with(options.outputDir, ".vpc"))
if (isVpcFilename(options.outputDir))
{
options.outputDir = options.outputDir.substr(0, options.outputDir.size()-4);
options.buildVpc = true;
Expand Down
2 changes: 1 addition & 1 deletion src/to_raster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ static std::unique_ptr<PipelineManager> pipeline(ParallelJobInfo *tile, double r

void ToRaster::preparePipelines(std::vector<std::unique_ptr<PipelineManager>>& pipelines)
{
if (ends_with(inputFile, ".vpc"))
if (isVpcFilename(inputFile))
{
// using spatial processing

Expand Down
2 changes: 1 addition & 1 deletion src/to_raster_tin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ std::unique_ptr<PipelineManager> pipeline(ParallelJobInfo *tile, double resoluti

void ToRasterTin::preparePipelines(std::vector<std::unique_ptr<PipelineManager>>& pipelines)
{
if (ends_with(inputFile, ".vpc"))
if (isVpcFilename(inputFile))
{
// using spatial processing

Expand Down
4 changes: 2 additions & 2 deletions src/to_vector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ static std::unique_ptr<PipelineManager> pipeline(ParallelJobInfo *tile, const st

void ToVector::preparePipelines(std::vector<std::unique_ptr<PipelineManager>>& pipelines)
{
if (ends_with(inputFile, ".vpc"))
if (isVpcFilename(inputFile))
{
// for /tmp/hello.vpc we will use /tmp/hello dir for all results
fs::path outputParentDir = fs::path(outputFile).parent_path();
Expand Down Expand Up @@ -134,7 +134,7 @@ void ToVector::finalize(std::vector<std::unique_ptr<PipelineManager>>&)
if (tileOutputFiles.empty())
return;

if (ends_with(inputFile, ".vpc"))
if (isVpcFilename(inputFile))
{
// for /tmp/hello.vpc we will use /tmp/hello dir for all results
fs::path outputParentDir = fs::path(outputFile).parent_path();
Expand Down
4 changes: 2 additions & 2 deletions src/translate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ bool Translate::checkArgs()
}
}

if ( ends_with(outputFile, ".vpc") && outputFormatVpc == "copc" )
if ( isVpcFilename(outputFile) && outputFormatVpc == "copc" )
{
isStreaming = false;
}
Expand Down Expand Up @@ -164,7 +164,7 @@ static std::unique_ptr<PipelineManager> pipeline(ParallelJobInfo *tile, std::str

void Translate::preparePipelines(std::vector<std::unique_ptr<PipelineManager>>& pipelines)
{
if (ends_with(inputFile, ".vpc"))
if (isVpcFilename(inputFile))
{
// for /tmp/hello.vpc we will use /tmp/hello dir for all results
fs::path outputParentDir = fs::path(outputFile).parent_path();
Expand Down
6 changes: 3 additions & 3 deletions src/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ void buildOutput(std::string outputFile, std::vector<std::string> &tileOutputFil
for (std::string f : tileOutputFiles)
args.push_back(f);

if (ends_with(outputFile, ".vpc"))
if (isVpcFilename(outputFile))
{
// now build a new output VPC
buildVpc(args);
Expand Down Expand Up @@ -368,7 +368,7 @@ std::string tileOutputFileName(const std::string &outputFile, const std::string

// output is not a VPC, it will be merged later into a single file,
// use las to avoid zipping the file, it will be removed after merging
if (!ends_with(outputFile, ".vpc"))
if (!isVpcFilename(outputFile))
{
return fullFileNameWithoutExt + ".las";
}
Expand All @@ -383,4 +383,4 @@ std::string tileOutputFileName(const std::string &outputFile, const std::string
}

return fullFileNameWithoutExt + "." + ext;
}
}
5 changes: 5 additions & 0 deletions src/utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,11 @@ inline bool ends_with(std::string const & value, std::string const & ending)
return std::equal(ending.rbegin(), ending.rend(), value.rbegin());
}

inline bool isVpcFilename(const std::string& filename)
{
return ends_with(filename, ".vpc") || ends_with(filename, ".vpz");
}


inline std::string join_strings(const std::vector<std::string>& list, char delimiter)
{
Expand Down
Loading
Loading