[pdal] Linking with PCL

pidgeon13 at googlemail.com pidgeon13 at googlemail.com
Mon Dec 18 02:17:01 PST 2017


When I run pdal –drivers in the command prompt it does list the filter as being found. My configuration script sets PCL to build and libpdal_plugin_filter_voxelgrid.dll has been created in the bin folder.

Sent from Mail for Windows 10

From: Andrew Bell
Sent: 15 December 2017 12:57
To: Stephen Pidgeon
Cc: pdal at lists.osgeo.org
Subject: Re: [pdal] Linking with PCL

The StageFactory must be able to locate the plugin.  See the second question in the FAQ: https://www.pdal.io/faq.html

On Fri, Dec 15, 2017 at 4:44 AM, <pidgeon13 at googlemail.com> wrote:
Hi,
 
I am trying to use the voxelgrid filter in some c++ code I am writing (and would also like to be able to read and write .pcd files). I believe I have linked in PCL correctly, and my solution builds the plugin .dll files. However, although there is plenty of information on the PDAL website about using PCL in pipelines, I have not managed to find anything to help me use the API. I currently have a function I am playing around with to try and get the filter to work:
 
bool ReadFilterWrite(const std::string& inputfilename, const std::string& readerdriver, const std::string& outputfilename)
{
                bool bFilterWorks=false;
               pdal::StageFactory factory;
                pdal::PointTable table;
                pdal::Stage *pReader = factory.createStage(readerdriver);
                pdal::Options readerOptions;
                readerOptions.add("filename", inputfilename);
                if (pReader)
                {
                                pReader->setOptions(readerOptions);
                }
                else
                {
                                return false;
                }
                pdal::Options writerOptions;
                writerOptions.add("filename", outputfilename);
                pdal::Stage *pWriter = factory.createStage("writers.text");
                if (pWriter)
                {
                                pdal::Stage *pFilter = factory.createStage("filters.voxelgrid");
                                if (pFilter)
                                {
                                                bFilterWorks = true;
                                                pFilter->setInput(*pReader);
                                                pWriter->setInput(*pFilter);
                                }
                                else
                                {
                                               //Currently commented out so that files are only written if the filter works.
                                                //pWriter->setInput(*pReader);
                                                return false; //Temporary, currently where the function exits.
                                }
                                pWriter->setOptions(writerOptions);
                                pWriter->prepare(table);
                                pWriter->execute(table);
                }
                return bFilterWorks;
}
 
The function reads the data in from a .las file (for example) fine, but then doesn’t create the filter stage. Am I going about this in the right way?
 
Best regards,
 
Stephen
 
Sent from Mail for Windows 10
 

_______________________________________________
pdal mailing list
pdal at lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/pdal




-- 
Andrew Bell
andrew.bell.ia at gmail.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/pdal/attachments/20171218/f1a456a4/attachment.html>


More information about the pdal mailing list