diff --git a/README.md b/README.md index 1886ae4..4dd9f82 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,6 @@ # Untwine -Untwine is software from [Hobu, Inc.](https://hobu.co) for creating [Entwine Point Tile](https://entwine.io/entwine-point-tile.html) (EPT) -or [Cloud Optimized Point Cloud](https://copc.io/) (COPC) web services from [PDAL](https://pdal.io)-readable point cloud data sources. It -provides an alternative processing approach than the [Entwine](https://entwine.io) -software, but the output is expected to be compatible EPT/COPC. +Untwine is software from [Hobu, Inc.](https://hobu.co) for creating [Cloud Optimized Point Cloud](https://copc.io/) (COPC) web services from [PDAL](https://pdal.io)-readable point cloud data sources. License @@ -54,9 +51,9 @@ Options Input files or directories containing input files. [Required] -- output_dir +- output_file - Output directory. [Required] + Output file. [Required] - a_srs diff --git a/bu/Processor.cpp b/bu/Processor.cpp index 7bfbcf3..c7e7d73 100644 --- a/bu/Processor.cpp +++ b/bu/Processor.cpp @@ -52,14 +52,12 @@ void Processor::run() } catch (const std::exception& ex) { - std::cerr << "Exception: " << ex.what() << "\n"; m_manager.queueWithError(m_vi.octant(), ex.what()); return; } catch (...) { std::string msg = std::string("Unexpected error processing ") + m_vi.key().toString() + "."; - std::cerr << "Exception: " << msg << "\n"; m_manager.queueWithError(m_vi.octant(), msg); return; } @@ -490,7 +488,7 @@ void Processor::createChunk(const VoxelKey& key, pdal::PointViewPtr view) out.write(reinterpret_cast(chunk.data()), chunk.size()); out.close(); if (!out) - throw FatalError("Failure writing to '" + m_b.opts.outputName + "'."); + throw FatalError("Failure writing to file '" + m_b.opts.outputName + "'."); } void Processor::fillPointBuf(pdal::PointRef& point, std::vector& buf, diff --git a/bu/PyramidManager.cpp b/bu/PyramidManager.cpp index 36748c1..54345be 100644 --- a/bu/PyramidManager.cpp +++ b/bu/PyramidManager.cpp @@ -79,7 +79,8 @@ void PyramidManager::run() if (m_error.size()) { - std::cerr << "Exception: " << m_error << "\n"; + lock.unlock(); + m_pool.join(); throw FatalError(m_error); } } diff --git a/epf/Writer.cpp b/epf/Writer.cpp index 40175c5..3e25584 100644 --- a/epf/Writer.cpp +++ b/epf/Writer.cpp @@ -153,7 +153,7 @@ void Writer::run() std::lock_guard lock(m_mutex); if (!out) { - m_pool.setError("Failure writing to '" + path(wd.key) + "'."); + m_pool.setError("Failure writing to file '" + path(wd.key) + "'."); m_stop = true; } else diff --git a/untwine/Untwine.cpp b/untwine/Untwine.cpp index 03038fa..e398bed 100644 --- a/untwine/Untwine.cpp +++ b/untwine/Untwine.cpp @@ -75,7 +75,7 @@ bool handleOptions(pdal::StringList& arglist, Options& options) std::cout << "untwine version (" << UNTWINE_VERSION << ")\n"; if (help) { - std::cout << "Usage: untwine [output file/directory] \n"; + std::cout << "Usage: untwine output file \n"; programArgs.dump(std::cout, 2, 80); } if (help || version) @@ -83,6 +83,14 @@ bool handleOptions(pdal::StringList& arglist, Options& options) programArgs.parse(arglist); + // Make sure the output file can be opened so that we can provide an early error if + // there's a problem. + std::ofstream tmp(os::toNative(options.outputName), std::ios::out | std::ios::binary); + if (!tmp) + throw FatalError("Can't open file '" + options.outputName + "' for output"); + tmp.close(); + pdal::FileUtils::deleteFile(options.outputName); + if (!tempArg->set()) { options.tempDir = options.outputName + "_tmp";