Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/bin/bash

# readlink gets us the full path to the file. This is necessary for docker
readlinker=`readlink -f $1`
# returns just the directory name
pathname=`dirname $readlinker`
# basename will strip off the directory name and the extension
name=`basename $1 .las`


for START in 0:1.5 1.5:3 3:6 6:15 15:30 30:45 45:60 60:105 105:150 150:200
        do
        # A little cleanup is necessary, so we're removing the colon ":".
        nameend=`echo $START | sed s/:/-/g`

        # Name our output
        lasname=$name"_"$nameend.las

        # Implement the height range filter
        docker run -v $(pwd)/data:/data pdal/pdal:1.4 pdal pipeline /data/poopline.json --readers.las.filename=/data/20001800PAS.las --writers.las.filename=/data/"$lasname" --filters.range.limits="Z[$START)"

done
{
  "pipeline":[
    "/data/20001800PAS.las",
    {
      "type":"readers.las",
      "filename":"/data/20001800PAS.las"
    },
    {
      "type":"filters.hag"
    },
    {
      "type":"filters.ferry",
      "dimensions":"HeightAboveGround = Z"
    },
    {
      "type":"filters.range",
      "limits":"Z[1:10]"
    },
    {
     "type":"filters.sample",
     "radius":"5"
    },
    {
      "type":"filters.reprojection",
      "out_srs":"EPSG:3651"
    },
    {
      "type":"writers.las",
      "filename":"/data/poisson_8-16.bpf"
    }
  ]
}
ls data/*PAS.las | parallel -j8 ./loop.sh
{
  "pipeline":[
    "input.las",
    {
     "type":"filters.sample",
     "radius":"0.5"
    },
    {
      "type":"filters.pmf",
      "extract":"true"
    },

    {
      "resolution": 1,
      "radius": 5,
      "filename":"outputfile.tif"
    }
  ]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment