<div dir="ltr">You need to build your writer (a plugin) into a shared object that can be loaded by the plugin manager.  It needs to be called libpdal_plugin_writer_PdalVectorMapWriter.<your shared library extension>.  The shared library needs to be located somewhere that the plugin manager can find it.  By default, PDAL will look in the following directories for plugins:<div><br></div><div>".", "./lib", "../lib", "./bin", "../bin"<br></div><div><br></div><div>If you're using cmake, you can use the PDAL build to generate the shared library for you.  Here's an example plugin:</div><div><br></div><div><a href="https://github.com/gadomski/cpd.git">https://github.com/gadomski/cpd.git</a><br></div><div><br></div><div>Note that you don't have to do ANY of this if you're not using the pipeline/plugin manager to run your writer from a JSON pipeline.  If you're executing code programmatically, you can simply add your writer to the end of a pipeline and call prepare() and execute() on the pipeline that you've created in code.</div><div> </div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jul 11, 2017 at 10:59 AM, Paul Schrum <span dir="ltr"><<a href="mailto:paul.schrum@gmail.com" target="_blank">paul.schrum@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Thank you Andrew.<br><br></div><div>In the cpp file containing the class, I have the following lines:<br><br><span style="font-family:monospace,monospace">  static PluginInfo const s_info = PluginInfo(<br>    "writers.PdalVectorMapWriter",<br>    "Custom Writer to write a GRASS Vector Map",<br>    "<a href="http://no/documentation/yet" target="_blank">http://no/documentation/yet</a>" );<br><br>  CREATE_SHARED_PLUGIN(1, 0, PdalVectorMapWriter, Writer, s_info);<br></span><br></div><div>So would the only other thing I need to do be to tell pdal where to find the class?  I don't have to instantiate the class and pass it the instance?<br><br></div><div>The class lives in my GRASS executable, v.in.pdal.  How do I tell pdal to append PDAL_DRIVER_PATH with v.in.pdal's path, and is that sufficient?<br><br></div><div>I see in <a href="https://github.com/PDAL/PDAL/tree/master/plugins" target="_blank">https://github.com/PDAL/PDAL/<wbr>tree/master/plugins</a> that  these are built using CMake.  But GRASS uses make, so I don't know how to make these work together.  Is it not possible for me simply to pass an instance of my class to some kind of pdal->registerPlugIn() function or something similar which happens at runtime?<span class="HOEnZb"><font color="#888888"><br></font></span></div><span class="HOEnZb"><font color="#888888"><div><br></div>- Paul<br><br></font></span></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jul 10, 2017 at 7:56 PM, Andrew Bell <span dir="ltr"><<a href="mailto:andrew.bell.ia@gmail.com" target="_blank">andrew.bell.ia@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">You need to build your writer as a shared plugin and make sure that the dll/so that you create is in a folder where the plugin manager will look for it (or set PDAL_DRIVER_PATH).  Take a look at one of the existing plugins in the "plutgins" subdirectory of pdal.  Let me know if you need more help.</div><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="m_-2429901598987662413h5">On Mon, Jul 10, 2017 at 5:11 PM, Paul Schrum <span dir="ltr"><<a href="mailto:paul.schrum@gmail.com" target="_blank">paul.schrum@gmail.com</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="m_-2429901598987662413h5"><div dir="ltr"><div><div><div><div><div><div>I am developing a custom PDAL writer for my GSoC project. (<a href="https://trac.osgeo.org/grass/wiki/GSoC/2017/IntegrationOfPDALintoGRASSGIS" target="_blank">Link</a>)  Source Code is on <a href="https://github.com/PaulSchrum/v_in_pdal" target="_blank">github</a>.  The module compiles, but it is an intermediate state since I am in the process of developing it.<br><br></div>I have the custom writer, PdalVectorMapWriter,  inheriting from writer and it compiles okay.  Currently all functions just print out their own name and return.<br><br></div>In main.cpp I create the pipeline json string and create a PipelineExecutor with it.  I then call pipeline-> validate.  This throws an exception stating <br><br><span style="font-family:monospace,monospace">terminate called after throwing an instance of 'pdal::pdal_error'<br>  what():  Couldn't create writer stage of type 'writers.PdalVectorMapWriter'.</span><br><br></div>So I am thinking that I need somehow to inform Pdal about an instance of the class.  But as I go over the Pdal documentation, I do not see how to do that.  Can someone help me understand what I need to do?<br><br></div>- Paul<br><br></div>Here is a key code snippet:<br><span style="font-family:monospace,monospace">81    std::string pipeline_json =<br>82            pipelineJson::basicVectorMapRe<wbr>aderWriter(inFile,outFile);<br>83<br>84    cout << pipeline_json << endl;  //diagnostic only<br>85    cout << endl;<br>86    G_important_message(_("Running the pipeline ..."));<br>87    auto pipeline = new pdal::PipelineExecutor(pipelin<wbr>e_json);<br>88    <br>87    cout << "is valid?  " << pipeline->validate() << endl;<br></span><br></div><div>Line 87 throws the exception.<br></div><br><br>Here is the json string being passed to the PipelineExecutor constructor:<br><div><font size="2"><span style="font-family:monospace,monospace"><br>{ "pipeline":[<br><font size="1">   "/home/user/Desktop/ALL/Source<wbr>Modules/cpp/grass7_trunk/vecto<wbr>r/v.in.pdal/testFiles/100-<wbr>points.las",<br></font>{<br>   "type":"writers.PdalVectorMapW<wbr>riter",<br>   "filename":"100-points"<br>}<br> ]<br>}</span></font><br><br><div><div><br><br></div></div></div></div>
<br></div></div>______________________________<wbr>_________________<br>
pdal mailing list<br>
<a href="mailto:pdal@lists.osgeo.org" target="_blank">pdal@lists.osgeo.org</a><br>
<a href="https://lists.osgeo.org/mailman/listinfo/pdal" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailma<wbr>n/listinfo/pdal</a><span class="m_-2429901598987662413HOEnZb"><font color="#888888"><br></font></span></blockquote></div><span class="m_-2429901598987662413HOEnZb"><font color="#888888"><br><br clear="all"><div><br></div>-- <br><div class="m_-2429901598987662413m_-1955143350056331847gmail_signature" data-smartmail="gmail_signature">Andrew Bell<br><a href="mailto:andrew.bell.ia@gmail.com" target="_blank">andrew.bell.ia@gmail.com</a></div>
</font></span></div>
</blockquote></div><br></div>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature">Andrew Bell<br><a href="mailto:andrew.bell.ia@gmail.com" target="_blank">andrew.bell.ia@gmail.com</a></div>
</div>