[pdal] One last follow up.
David Serret Mayer
david.serret at eigendynamics.com
Thu Aug 30 06:51:01 PDT 2018
Hey there!
Hopefully this will be my last question, let see if I can finally get it
right.
I tried today to use the Pipeline manager as recommended. But I cant figure
out how to make it work with an reader.buffer type as input.
If I put the JSON like this:
{
"pipeline":[
{
"type":"readers.buffer"
},
{
"type":"filters.chipper",
"capacity":"400"
},
{
"type":"writers.pgpointcloud",
"connection":"dbname='lidar' user='user'"
}
]
}
I get the error: Couldn't create reader stage of type 'readers.buffer'.
If I stage the buffer as seen on SmoothKernel.cpp y get the same error.
....
PipelineManager mgr;
mgr.readPipeline("../p.json");
BufferReader& bufferReader =
dynamic_cast<BufferReader&>(mgr.makeReader("",
"readers.buffer"));
bufferReader.addView(view);
mgr.prepare();
mgr.execute();
....
This is the program I am working on right now:
#include <pdal/filters/ChipperFilter.hpp>
#include <io/BufferReader.hpp>
#include <io/BufferReader.hpp>
#include <pdal/Kernel.hpp>
#include <pdal/pdal_export.hpp>
#include <pdal/util/FileUtils.hpp>
#include<pdal/PipelineReaderJSON.hpp>
//#include <pdal/plugins/pgpointcloud/io/PgCommon.hpp">
#include <memory>
#include <vector>
#include <pdal/PDALUtils.hpp>
#include <pdal/StageFactory.hpp>
#include <pdal/PipelineExecutor.hpp>
#include <pdal/util/FileUtils.hpp>
void fillView(pdal::PointViewPtr view)
{
struct Point
{
double x;
double y;
double z;
};
for (float i = 0; i < 10000; i += 1.0)
{
Point p;
p.x = -93.0 + i*0.00000001*i;
p.y = 42.0 + i*0.00001*i*i;
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()
{
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);
BufferReader r;
r.addView(view);
PipelineManager mgr;
mgr.readPipeline("../p.json");
mgr.prepare();
mgr.execute();
}
p.json is:
{
"pipeline":[
{"type":"readers.buffer" <-wrong
},
{
"type":"filters.chipper",
"capacity":"400"
},
{
"type":"writers.pgpointcloud",
"connection":"dbname='lidar' user='user'"
}
]
}
Again, thanks in advance for your help.
--
*David Serret *- R&D Engineer at Eigen Dynamics SL
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/pdal/attachments/20180830/986c626c/attachment.html>
More information about the pdal
mailing list