<div dir="ltr"><div>I have two questions ,I am trying to use PDAL with the c++ API.</div><div><br></div><div><br></div><div>First, Is there a way to "parse" json directly into a stagefactory. That would be great!</div><div><br></div><div><br></div><div>Second, how do I collect the output from the filter in this program</div><div><br></div><div><br></div><div>#include <pdal/PointView.hpp><br>#include <pdal/PointTable.hpp><br>#include <pdal/Dimension.hpp><br>#include <pdal/Options.hpp><br>#include <pdal/StageFactory.hpp><br>#include <pdal/Filter.hpp><br>#include <pdal/filters/ChipperFilter.hpp><br>#include <pdal/filters/RandomizeFilter.hpp><br>#include <pdal/filters/ApproximateCoplanarFilter.hpp><br><br><br>#include <io/BufferReader.hpp><br><br>#include <vector><br><br>void fillView(pdal::PointViewPtr view)<br>{<br>    struct Point<br>    {<br>        double x;<br>        double y;<br>        double z;<br>    };<br><br>    for (int i = 0; i < 1000; ++i)<br>    {<br>        Point p;<br><br>        p.x = -93.0 + i*1;<br>        p.y = 42.0 + i*0.1;<br>        p.z = 106.0 + i;<br><br>        view->setField(pdal::Dimension::Id::X, i, p.x);<br>        view->setField(pdal::Dimension::Id::Y, i, p.y);<br>        view->setField(pdal::Dimension::Id::Z, i, p.z);<br>    }<br>}<br><br><br>int main(int argc, char* argv[])<br>{<br>    using namespace pdal;<br><br><br>    PointTable table;<br>    table.layout()->registerDim(Dimension::Id::X);<br>    table.layout()->registerDim(Dimension::Id::Y);<br>    table.layout()->registerDim(Dimension::Id::Z);<br><br>    PointViewPtr view(new PointView(table));<br><br>    fillView(view);<br><br>    ChipperFilter appr;<br>    Options options;<br><br>    options.add("knn",8);<br>    options.add("thresh1",25);<br>    options.add("thresh2",6);<br><br>    StageFactory factory;<br><br><br>    Stage *filter =  new( ApproximateCoplanarFilter );<br><br>    filter->setInput(appr);<br>    filter->setOptions(options);<br>    filter->prepare(table);<br>    filter->execute(table);<br> <br>    PointViewPtr view2(new PointView(table));<br>    fillView(view2);<br><br>    std::cout << view2->size() << std::endl; // still 1000...<br>}<br><br></div><div><br></div><div><br></div><div>Thank you very much!<br></div><div><br>-- <br><div class="gmail_signature"><div dir="ltr"><b>David Serret </b>- R&D Engineer at Eigen Dynamics SL<br><img src="http://www.eigendynamics.com/wp-content/uploads/2017/02/EigenLogo200dpi-1.jpg" width="200" height="88"></div></div>
</div></div>