Skip to content

Commit

Permalink
Log dimensions being written to LAS extra bytes.
Browse files Browse the repository at this point in the history
Close #1479
  • Loading branch information
abellgithub committed Jan 31, 2017
1 parent d1da72c commit 5edf404
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
8 changes: 5 additions & 3 deletions doc/stages/writers.las.rst
Expand Up @@ -159,9 +159,11 @@ extra_dims
extra dimensions specified by this option.

The special value 'all' can be used in place of a dimension/type list
to request
that all dimensions that can't be stored in the predefined LAS point
record get added as extra data at the end of each point record.
to request that all dimensions that can't be stored in the predefined
LAS point record get added as extra data at the end of each point record.

Setting --verbose=Info will provide output on the names, types and order
of dimensions being written as part of the LAS extra bytes.

.. _LAS format: http://asprs.org/Committee-General/LASer-LAS-File-Format-Exchange-Activities.html

11 changes: 10 additions & 1 deletion io/LasWriter.cpp
Expand Up @@ -37,6 +37,7 @@
#include <iostream>

#include <pdal/Compression.hpp>
#include <pdal/DimUtil.hpp>
#include <pdal/PDALUtils.hpp>
#include <pdal/PointView.hpp>
#include <pdal/util/Algorithm.hpp>
Expand Down Expand Up @@ -139,7 +140,7 @@ void LasWriter::spatialReferenceChanged(const SpatialReference&)
if (++m_srsCnt > 1)
log()->get(LogLevel::Error) << getName() <<
": Attempting to write '" << m_filename << "' with multiple "
"point spatial references.";
"point spatial references." << std::endl;
}


Expand All @@ -149,6 +150,10 @@ void LasWriter::prepared(PointTableRef table)

PointLayoutPtr layout = table.layout();

// Make sure the dataformatID is set so that we can get the proper
// dimensions being written as part of the standard LAS record.
fillHeader();

// If we've asked for all dimensions, add to extraDims all dimensions
// in the layout that aren't already destined for LAS output.
if (m_extraDims.size() == 1 && m_extraDims[0].m_name == "all")
Expand Down Expand Up @@ -176,6 +181,10 @@ void LasWriter::prepared(PointTableRef table)
throw pdal_error(oss.str());
}
m_extraByteLen += Dimension::size(dim.m_dimType.m_type);
log()->get(LogLevel::Info) << getName() << ": Writing dimension " <<
dim.m_name <<
"(" << Dimension::interpretationName(dim.m_dimType.m_type) <<
") " << " to LAS extra bytes." << std::endl;
}
}

Expand Down

0 comments on commit 5edf404

Please sign in to comment.