1

Im trying to run pdal merge on a large number of laz files. An example of my current script is..

pdal merge file1.laz file2.laz file3.laz d:\outputs\merged.copc.laz

I know form the documents theres a way to create a where expression, to remove unwanted classifications, from my own investigations I believe the syntax of what I want to be, for example...

((Classification != 0) && (Classification != 7))

I cannot see though, how to implament the where expression in my script, does anyone have any experience in this that might be able to guide me?

1 Answers1

1

It is probably best to use a pipeline to do this job instead of the pdal merge utility, which is deficient and options and slated for deprecation.

I would do something like this

{
  "pipeline":
  [
    "file1.laz",
    "file2.laz",
    "file3.laz",
    {
      "type":"filters.expression",
      "expression":"((Classification != 0) && (Classification != 7))"
    },
    {
      "type":"writers.copc",
      "filename":"merged.copc.laz"
    }
  ]
}

The problem with this, however, is that if you were merging a lot of files, ALL of the data is going to be brought into memory due to writers.copc (the PDAL COPC writer needs to sort all of the data and it does this in memory).

An alternative approach that would scale better is to use PDAL to filter each file and then merge those using Untwine. Untwine uses disk (sometimes a lot!) to manage the sort of COPC (or EPT) data, and this scales up much less harshly.

Howard Butler
  • 4,013
  • 22
  • 26
  • Thanks so much for your help and advice. I will investigate Untwine as an option in future. At present its a proof of concept and im restricted in what I can install. – Richard McDonnell Jun 26 '23 at 09:37