[pdal] Accessing point data directly

Andrew Bell andrew.bell.ia at gmail.com
Mon Dec 4 06:26:00 PST 2017


1) If you're doing processing as in a PDAL pipeline, you can just write a
stage that does the processing you wish.  Take a look at:

https://www.pdal.io/development/writing-filter.html

If all you want to do is read the data, you can just implement run() or
filter().


2) If you want to read all the points into memory and then access the data
you can do something like:

main()
{
  PointTable t;

  LasReader r;
  Options o;
  o.add("filename", "somefile.las");
  r.setOptions(o);

  r.prepare(t);
  PointViewSet s = r.execute(t);
  PointViewPtr v = *s.begin();  // Assumes one PointView

  for (PointId id = 0; i < v.size(); ++i)
  {
    double x = v->getFieldAs<double>(Dimension::Id::X, i);
    double y = v->getFieldAs<double>(Dimension::Id::Y, i);
    double z = v->getFieldAs<double>(Dimension::Id::Z, i);
}

If you have the source or are looking at it on Github, there are lots of
examples of how you might access data in the test/unit directory.

Hope that helps,


On Mon, Dec 4, 2017 at 9:00 AM, <pidgeon13 at googlemail.com> wrote:

> Hi all,
>
>
>
> I am writing a C++ program that makes use of PDAL. I would like to be able
> to read in a file (for example a .las file) and then access the data for
> the points directly. For example I’d like to know the X, Y, and Z values
> for the first point. How would be the best way of doing this? I’ve been
> looking through the API but I’m not entirely sure what I’m looking for.
> I’ve managed to use the readers, writers, and filters, but I’m struggling
> to work out how to access the data. If someone could give me a point in the
> right direction that would be great!
>
>
>
> Thanks,
>
> Stephen
>
>
>
> Sent from Mail <https://go.microsoft.com/fwlink/?LinkId=550986> 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/20171204/847e3766/attachment.html>


More information about the pdal mailing list