Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/issue-1910' into 1.7-maintenance
Browse files Browse the repository at this point in the history
  • Loading branch information
hobu committed Apr 6, 2018
2 parents 7ec8d38 + 5fbb7e7 commit 34350aa
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 8 deletions.
5 changes: 4 additions & 1 deletion io/GeotiffSupport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,9 @@ GeotiffSrs::GeotiffSrs(const std::vector<uint8_t>& directoryRec,
}

ctx.gtiff = GTIFNewSimpleTags(ctx.tiff);
if (!ctx.gtiff)
throw Geotiff::error("Couldn't create Geotiff tags from "
"Geotiff definition.");

GTIFDefn sGTIFDefn;
if (GTIFGetDefn(ctx.gtiff, &sGTIFDefn))
Expand All @@ -144,7 +147,7 @@ GeotiffTags::GeotiffTags(const SpatialReference& srs)

// Set tiff tags from WKT
if (!GTIFSetFromOGISDefn(ctx.gtiff, srs.getWKT().c_str()))
throw error("Could not set m_gtiff from WKT");
throw Geotiff::error("Could not set m_gtiff from WKT");
GTIFWriteKeys(ctx.gtiff);

auto sizeFromType = [](int type, int count) -> size_t
Expand Down
15 changes: 9 additions & 6 deletions io/GeotiffSupport.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,15 @@
namespace pdal
{

namespace Geotiff
{
struct error : public std::runtime_error
{
error(const std::string& err) : std::runtime_error(err)
{}
};
}

class GeotiffSrs
{
public:
Expand All @@ -54,12 +63,6 @@ class GeotiffSrs
class GeotiffTags
{
public:
struct error : public std::runtime_error
{
error(const std::string& err) : std::runtime_error(err)
{}
};

GeotiffTags(const SpatialReference& srs);

std::vector<uint8_t>& directoryData()
Expand Down
5 changes: 5 additions & 0 deletions io/LasHeader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,11 @@ void LasHeader::setSrs()
else
setSrsFromGeotiff();
}
catch (Geotiff::error err)
{
m_log->get(LogLevel::Error) << "Could not create an SRS: " <<
err.what() << std::endl;
}
catch (...)
{
m_log->get(LogLevel::Error) << "Could not create an SRS" << std::endl;
Expand Down
2 changes: 1 addition & 1 deletion io/LasWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ void LasWriter::addGeotiffVlrs()
addVlr(TRANSFORM_USER_ID, GEOTIFF_ASCII_RECORD_ID,
"GeoTiff GeoAsciiParamsTag", tags.asciiData());
}
catch (GeotiffTags::error& err)
catch (Geotiff::error& err)
{
throwError(err.what());
}
Expand Down

0 comments on commit 34350aa

Please sign in to comment.