[pdal] Documentation on using PDAL

Howard Butler howard at hobu.co
Fri Apr 15 08:36:42 PDT 2016


César,

Vaclav's document has a little bit of guidance on this topic, but you are correct in there isn't a whole lot of "I just want to read points in my C++ application" tutorial or documentation. See http://www.pdal.io/tutorial/liblas_to_pdal.html

Other responses inline...

> On Apr 15, 2016, at 4:06 AM, César Martínez Izquierdo <cesar.izq at gmail.com> wrote:
> 
> Dear list,
> 
> I'm evaluating using PDAL to read and write LAS files. My use case is focused on the following requirements:
> - accessing to individual points on the LAS files (sometimes sequentially and sometimes to specific records using record number)

Some drivers, such as readers.las, support one-at-a-time reading. There probably very little performance benefit to doing so unless you have extremely large files and you're trying to conserve memory as you read for some reason. 

> - learning about LAS file properties (coordinate reference system of the data, number of records, existing fields [which depends on the record point type in use], etc)

Stage, PipelineManager, and PointTable all have methods to get MetadataNode instances, which are a tree of information that would include that kind of stuff for LAS. Each driver produces different metadata, and filters can add to a PointTable's metadata as the process as well.

> - creating new LAS files and writing individual points to them

I think you will find the code for "pdal translate" instructive. See [1] for more details.

> - appending individual points to existing LAS files, maybe also editing or deleting existing points

Nope. No open source LAS library supports that one very well. Too many ways to screw up, and it's much simpler just to write a new file. LASlib supports a little bit of in-place header modification, but that can be dangerous if the header size is changing. Not worth the pain.

> 
> Is PDAL able to satisfy these use cases? I have read the online documentation, but it seems to be really focused on translating from one format to another one, and there is little information about how to actually accessing the points.

The website documentation is indeed focused on external use of PDAL through pipelines and applications, but there is a very deep codebase to do the kinds of things you want. There aren't so many docs on those, however, and you'll have to read through code and tests [2] for guidance and inspiration. 

> The "Writing with PDAL" tutorial [http://www.pdal.io/tutorial/writing.html] gives me some light on the writing part, but I still don't see if it really matches our use case. If I correctly understand the tutorial, you have to first create a PointTable and a PointView, which I guess are created on-memory.
> 
> Is there a way to "stream" the points to the writer? Otherwise I believe this approach is not feasible for writing big LAS files. Would be possible to create the writer on "append" mode and to feed it with several PointViews on a loop for instance?. Will this approach perform well or is there a better way to do it?

Others may have some experience on this topic. I think what you are describing is possible, but you should do some tests to see if it is really going to be a problem.

Howard

[1] https://github.com/PDAL/PDAL/blob/master/kernels/translate/TranslateKernel.cpp
[2] https://github.com/PDAL/PDAL/blob/master/test/unit/io/las/LasReaderTest.cpp


More information about the pdal mailing list