[pdal] C++ api questions
David Serret Mayer
david.serret at eigendynamics.com
Tue Aug 28 03:49:51 PDT 2018
I have two questions ,I am trying to use PDAL with the c++ API.
First, Is there a way to "parse" json directly into a stagefactory. That
would be great!
Second, how do I collect the output from the filter in this program
#include <pdal/PointView.hpp>
#include <pdal/PointTable.hpp>
#include <pdal/Dimension.hpp>
#include <pdal/Options.hpp>
#include <pdal/StageFactory.hpp>
#include <pdal/Filter.hpp>
#include <pdal/filters/ChipperFilter.hpp>
#include <pdal/filters/RandomizeFilter.hpp>
#include <pdal/filters/ApproximateCoplanarFilter.hpp>
#include <io/BufferReader.hpp>
#include <vector>
void fillView(pdal::PointViewPtr view)
{
struct Point
{
double x;
double y;
double z;
};
for (int i = 0; i < 1000; ++i)
{
Point p;
p.x = -93.0 + i*1;
p.y = 42.0 + i*0.1;
p.z = 106.0 + i;
view->setField(pdal::Dimension::Id::X, i, p.x);
view->setField(pdal::Dimension::Id::Y, i, p.y);
view->setField(pdal::Dimension::Id::Z, i, p.z);
}
}
int main(int argc, char* argv[])
{
using namespace pdal;
PointTable table;
table.layout()->registerDim(Dimension::Id::X);
table.layout()->registerDim(Dimension::Id::Y);
table.layout()->registerDim(Dimension::Id::Z);
PointViewPtr view(new PointView(table));
fillView(view);
ChipperFilter appr;
Options options;
options.add("knn",8);
options.add("thresh1",25);
options.add("thresh2",6);
StageFactory factory;
Stage *filter = new( ApproximateCoplanarFilter );
filter->setInput(appr);
filter->setOptions(options);
filter->prepare(table);
filter->execute(table);
PointViewPtr view2(new PointView(table));
fillView(view2);
std::cout << view2->size() << std::endl; // still 1000...
}
Thank you very much!
--
*David Serret *- R&D Engineer at Eigen Dynamics SL
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/pdal/attachments/20180828/b384f0e9/attachment.html>
More information about the pdal
mailing list