Skip to content

Commit

Permalink
Merge branch 'master' into ept-zstandard-updates
Browse files Browse the repository at this point in the history
  • Loading branch information
connormanning committed Dec 4, 2019
2 parents d3dc634 + fce5d58 commit 046c865
Show file tree
Hide file tree
Showing 42 changed files with 1,574 additions and 1,338 deletions.
8 changes: 7 additions & 1 deletion doc/development/writing-filter.rst
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,13 @@ elements - the filter name, description, and a link to documentation.

PDAL requires that filter names always begin with ``filters.``, and end with a
string that uniquely identifies the filter. The description will be displayed
to users of the PDAL CLI (``pdal --drivers``).
to users of the PDAL CLI (``pdal --drivers``). When making a shared plugin,
the name of the shared library must correspond with the name of the filter
provided here. The name of the generated shared object must be

::

libpdal_plugin_filter_<filter name>.<shared library extension>

Next, we pass the following to the ``CREATE_SHARED_STAGE`` macro, passing in
the name of the stage and the ``PluginInfo`` struct.
Expand Down
8 changes: 8 additions & 0 deletions doc/development/writing-reader.rst
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,14 @@ to the main PDAL installation. The macro is supplied with the class name
of the plugin and a PluginInfo object. The PluginInfo objection includes
the name of the plugin, a description, and a link to documentation.

When making a shared plugin,
the name of the shared library must correspond with the name of the reader
provided here. The name of the generated shared object must be

::

libpdal_plugin_reader_<reader name>.<shared library extension>

.. literalinclude:: ../../examples/writing-reader/MyReader.cpp
:language: cpp
:lines: 8-15
Expand Down
7 changes: 7 additions & 0 deletions doc/development/writing-writer.rst
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,13 @@ to create a SHARED stage, which means it will be external to the main PDAL
installation. When using the macro, we specify the name of the Stage and
the PluginInfo struct we defined earlier.

When making a shared plugin, the name of the shared library must
correspond with the name of the writer
provided here. The name of the generated shared object must be

::
libpdal_plugin_writer_<writer name>.<shared library extension>

.. literalinclude:: ../../examples/writing-writer/MyWriter.cpp
:language: cpp
:lines: 20-31
Expand Down
10 changes: 5 additions & 5 deletions doc/project/docker.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Building Docker Containers for PDAL
PDAL's :ref:`repository <source>` is linked to `DockerHub`_ for automatic
building of `Docker`_ containers. PDAL keeps three Docker containers current.

* ``pdal/dependencies:latest`` -- PDAL's dependencies
* ``pdal/ubuntu-dependencies:latest`` -- PDAL's dependencies
* ``pdal/pdal:latest`` -- PDAL master
* ``pdal/pdal:1.5`` -- PDAL maintenance branch

Expand All @@ -22,7 +22,7 @@ building of `Docker`_ containers. PDAL keeps three Docker containers current.
.. note::

Containers are built upon the `Dependencies`_ container, but the
`Dependencies`_ container is not pinned to specific Xenial or PDAL release
`Dependencies`_ container is not pinned to specific Bionic or PDAL release
times. It corresponds to where ever the ``dependencies`` tag of the PDAL
source tree at https://github.com/PDAL/PDAL resides

Expand All @@ -34,7 +34,7 @@ Dependencies
The PDAL dependencies Docker container is used by both the latest and release
branch Docker containers. The dependencies container is also used during
:ref:`integration` testing by Travis. It is built using the Dockerfile at
https://github.com/PDAL/PDAL/blob/master/scripts/docker/dependencies/Dockerfile
https://github.com/PDAL/PDAL/blob/master/scripts/docker/ubuntu/dependencies/Dockerfile

The ``pdal/dependencies:latest`` image is regenerated by force-pushing a tag of
the SHA you wish to use to have `DockerHub`_ build.
Expand All @@ -46,10 +46,10 @@ the SHA you wish to use to have `DockerHub`_ build.

.. note::

The dependencies container is currently built upon `Ubuntu Xenial`_. When
The dependencies container is currently built upon `Ubuntu Bionic`_. When
the next Ubuntu LTS is released, the PDAL project will likely move to it.

.. _`Ubuntu Xenial`: http://releases.ubuntu.com/16.04/
.. _`Ubuntu Bionic`: http://releases.ubuntu.com/18.04/

Maintenance
================================================================================
Expand Down
8 changes: 8 additions & 0 deletions doc/stages/filters.stats.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@ The output of the stats filter is metadata that can be stored by writers or
used through the PDAL API. Output from the stats filter can also be
quickly obtained in JSON format by using the command "pdal info --stats".

.. note::

The filter can compute both sample and population statistics. For kurtosis,
the filter can also compute standard and excess kurtosis. However, only
a single value is reported for each statistic type in metadata, and that is
the sample statistic, rather than the population statistic. For kurtosis
the sample excess kurtosis is reported. This seems to match the behavior
of many other software packages.

Example
................................................................................
Expand Down
2 changes: 1 addition & 1 deletion filters/ColorinterpFilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ void ColorinterpFilter::filter(PointView& view)
}
else
{
double threshold = (m_stdDevThreshold * summary.stddev());
double threshold = (m_stdDevThreshold * summary.sampleStddev());
m_min = median - threshold;
m_max = median + threshold;

Expand Down
2 changes: 1 addition & 1 deletion filters/HAGFilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

#include <pdal/KDIndex.hpp>

#include "private/delaunator-decl.hpp"
#include "private/delaunator.hpp"

#include <string>
#include <vector>
Expand Down
65 changes: 17 additions & 48 deletions filters/OverlayFilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@

#include <vector>

#include <pdal/QuadIndex.hpp>
#include <pdal/GDALUtils.hpp>
#include <pdal/util/ProgramArgs.hpp>

Expand All @@ -53,26 +52,6 @@ static StaticPluginInfo const s_info

CREATE_STATIC_STAGE(OverlayFilter, s_info)

struct OGRDataSourceDeleter
{
template <typename T>
void operator()(T* ptr)
{
if (ptr)
::OGR_DS_Destroy(ptr);
}
};

struct OGRFeatureDeleter
{
template <typename T>
void operator()(T* ptr)
{
if (ptr)
::OGR_F_Destroy(ptr);
}
};


void OverlayFilter::addArgs(ProgramArgs& args)
{
Expand Down Expand Up @@ -105,7 +84,7 @@ void OverlayFilter::prepared(PointTableRef table)
void OverlayFilter::ready(PointTableRef table)
{
m_ds = OGRDSPtr(OGROpen(m_datasource.c_str(), 0, 0),
OGRDataSourceDeleter());
[](void *p){ if (p) ::OGR_DS_Destroy(p); });
if (!m_ds)
throwError("Unable to open data source '" + m_datasource + "'");

Expand All @@ -119,8 +98,13 @@ void OverlayFilter::ready(PointTableRef table)
if (!m_lyr)
throwError("Unable to select layer '" + m_layer + "'");

auto featureDeleter = [](void *p)
{
if (p)
::OGR_F_Destroy(p);
};
OGRFeaturePtr feature = OGRFeaturePtr(OGR_L_GetNextFeature(m_lyr),
OGRFeatureDeleter());
featureDeleter);

int field_index(1); // default to first column if nothing was set
if (m_column.size())
Expand All @@ -133,23 +117,12 @@ void OverlayFilter::ready(PointTableRef table)
do
{
OGRGeometryH geom = OGR_F_GetGeometryRef(feature.get());
OGRwkbGeometryType t = OGR_G_GetGeometryType(geom);
int32_t fieldVal = OGR_F_GetFieldAsInteger(feature.get(), field_index);

if (!(t == wkbPolygon ||
t == wkbMultiPolygon ||
t == wkbPolygon25D ||
t == wkbMultiPolygon25D))
{
throwError("Geometry is not Polygon or MultiPolygon!");
}

// Don't think Polygon meets criteria for implicit move ctor.
m_polygons.push_back(
{ Polygon(geom, table.anySpatialReference()), fieldVal} );

feature = OGRFeaturePtr(OGR_L_GetNextFeature(m_lyr),
OGRFeatureDeleter());
feature = OGRFeaturePtr(OGR_L_GetNextFeature(m_lyr), featureDeleter);
}
while (feature);
}
Expand All @@ -176,27 +149,23 @@ void OverlayFilter::spatialReferenceChanged(const SpatialReference& srs)
bool OverlayFilter::processOne(PointRef& point)
{
for (const auto& poly : m_polygons)
if (poly.geom.covers(point))
{
double x = point.getFieldAs<double>(Dimension::Id::X);
double y = point.getFieldAs<double>(Dimension::Id::Y);
if (poly.geom.contains(x, y))
point.setField(m_dim, poly.val);
}
return true;
}


void OverlayFilter::filter(PointView& view)
{
QuadIndex idx(view);

for (const auto& poly : m_polygons)
PointRef point(view, 0);
for (PointId id = 0; id < view.size(); ++id)
{
PointIdList ids = idx.getPoints(poly.geom.bounds());

PointRef point(view, 0);
for (PointId id : ids)
{
point.setPointId(id);
if (poly.geom.covers(point))
point.setField(m_dim, poly.val);
}
point.setPointId(id);
processOne(point);
}
}

Expand Down
12 changes: 8 additions & 4 deletions filters/SkewnessBalancingFilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ std::set<PointId> SkewnessBalancingFilter::processGround(PointViewPtr view)
point_count_t n1(0);
double delta, delta_n, term1, M1, M2, M3;
M1 = M2 = M3 = 0.0;
std::vector<double> skewness;
std::vector<double> skewness(view->size());
for (PointId i = 0; i < view->size(); ++i)
{
double z = view->getFieldAs<double>(Dimension::Id::Z, i);
Expand All @@ -83,14 +83,15 @@ std::set<PointId> SkewnessBalancingFilter::processGround(PointViewPtr view)
}

PointId j(0);
for (PointId i = view->size() - 1; i >= 0; --i)
PointId i(view->size());
do
{
if (skewness[i] <= 0)
{
j = i;
break;
}
}
} while (--i != 0);

std::set<PointId> groundIdx;
for (PointId i = 0; i <= j; ++i)
Expand All @@ -105,13 +106,16 @@ std::set<PointId> SkewnessBalancingFilter::processGround(PointViewPtr view)

PointViewSet SkewnessBalancingFilter::run(PointViewPtr input)
{
PointViewSet viewSet;
if (!input->size())
return viewSet;

bool logOutput = log()->getLevel() > LogLevel::Debug1;
if (logOutput)
log()->floatPrecision(8);

auto idx = processGround(input);

PointViewSet viewSet;
if (!idx.empty())
{
// set the classification label of ground returns as 2
Expand Down
10 changes: 5 additions & 5 deletions filters/StatsFilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,24 +68,24 @@ void Summary::extractMetadata(MetadataNode &m)
m.add("maximum", maximum(), "maximum");
m.add("average", average(), "average");

double std = stddev();
double std = sampleStddev();
if (!std::isinf(std) && !std::isnan(std))
m.add("stddev", std, "standard deviation");

double v = variance();
double v = sampleVariance();
if (!std::isinf(v) && !std::isnan(v))
m.add("variance", v, "variance");
m.add("name", m_name, "name");

if (m_advanced)
{
double k = kurtosis();
double k = sampleExcessKurtosis();
if (!std::isinf(k) && !std::isnan(k))
m.add("kurtosis", k, "kurtosis");

double sk = skewness();
double sk = sampleSkewness();
if (!std::isinf(sk) && !std::isnan(sk))
m.add("skewness", skewness(), "skewness");
m.add("skewness", sampleSkewness(), "skewness");
}

if (m_enumerate == Enumerate)
Expand Down

0 comments on commit 046c865

Please sign in to comment.