Skip to content

Commit

Permalink
Don't print multiple SRS message if we've overridden the SRS. (#2108)
Browse files Browse the repository at this point in the history
Close #2107
  • Loading branch information
abellgithub committed Jul 25, 2018
1 parent 9693732 commit 9ab6892
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion io/LasWriter.cpp
Expand Up @@ -177,7 +177,7 @@ void LasWriter::initialize()

void LasWriter::spatialReferenceChanged(const SpatialReference&)
{
if (++m_srsCnt > 1)
if (++m_srsCnt > 1 && m_aSrs.empty())
log()->get(LogLevel::Error) << getName() <<
": Attempting to write '" << m_filename << "' with multiple "
"point spatial references." << std::endl;
Expand Down
2 changes: 2 additions & 0 deletions io/LasWriter.hpp
Expand Up @@ -139,6 +139,8 @@ class PDAL_DLL LasWriter : public FlexWriter, public Streamable
virtual void readyTable(PointTableRef table);
virtual void readyFile(const std::string& filename,
const SpatialReference& srs);
virtual bool srsOverridden() const
{ return m_aSrs.valid(); }
virtual void writeView(const PointViewPtr view);
virtual bool processOne(PointRef& point);
void spatialReferenceChanged(const SpatialReference& srs);
Expand Down
7 changes: 5 additions & 2 deletions pdal/FlexWriter.hpp
Expand Up @@ -84,15 +84,18 @@ class PDAL_DLL FlexWriter : public Writer
#define final final
#endif

virtual bool srsOverridden() const
{ return false; }

virtual void ready(PointTableRef table) final
{
readyTable(table);
if (m_hashPos == std::string::npos)
{
if (!table.spatialReferenceUnique())
if (!table.spatialReferenceUnique() && !srsOverridden())
log()->get(LogLevel::Error) << getName() <<
": Attempting to write '" << m_filename <<
"' with multiple point spatial references.";
"' with multiple point spatial references." << std::endl;
readyFile(generateFilename(), table.spatialReference());
}
}
Expand Down

0 comments on commit 9ab6892

Please sign in to comment.