Skip to content

Commit

Permalink
Merge pull request #1032 from PDAL/bpf-auto-xyz-offsets
Browse files Browse the repository at this point in the history
BPF should use auto offsets by default for XYZ dimensions
  • Loading branch information
abellgithub committed Nov 16, 2015
2 parents 1394a1a + 1ee8a55 commit a241967
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
9 changes: 7 additions & 2 deletions doc/stages/writers.bpf.rst
Expand Up @@ -83,14 +83,19 @@ offset_x, offset_y, offset_z
Offset to be subtracted from the X, Y and Z nominal values, respectively,
before the value is scaled. The special value "auto" can be specified,
which causes the writer to set the offset to the minimum value of the
dimension. [Default: 0]
dimension. [Default: auto]

.. note::

written value = (nominal value - offset) / scale.

.. note::

Because BPF data is always stored in UTM, the XYZ offsets are set to
"auto" by default. This is to avoid truncation of the decimal digits
(which may occur with offsets left at 0).

output_dims
If specified, limits the dimensions written for each point. Dimensions
are listed by name and separated by commas. X, Y and Z are required and
must be explicitly listed.

13 changes: 12 additions & 1 deletion io/bpf/BpfWriter.cpp
Expand Up @@ -131,6 +131,18 @@ void BpfWriter::processOptions(const Options& options)
}
m_bundledFiles.push_back(ulemFile);
}

// BPF coordinates are always in UTM meters, which can be quite large.
// Allowing the writer to proceed with the default offset of 0 can lead to
// unexpected quantization of the coordinates. Instead, we force use of
// auto offset to subtract the minimum value in XYZ, unless of course, the
// user chooses to override with their own offset.
if (!options.hasOption("offset_x"))
m_xXform.m_autoOffset = true;
if (!options.hasOption("offset_y"))
m_yXform.m_autoOffset = true;
if (!options.hasOption("offset_z"))
m_zXform.m_autoOffset = true;
}


Expand Down Expand Up @@ -354,4 +366,3 @@ void BpfWriter::doneFile()
}

} //namespace pdal

0 comments on commit a241967

Please sign in to comment.