Part 9 of N… , see e.g. my previous post on the topic.
We’ve been working to reduce the effect of overlapping samples on statistics we run on LiDAR data, and to do so, we’ve been using PDAL’s filters.sample approach. One catch: this handles the horizontal sampling problem well, but we might want to intentionally retain samples from high locations — after all, I want to see the trees for the forest and vice versa. So, it might behoove us to sample within each of our desired height classes to retain as much vertical information as possible.
#!/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"
}
]
}
Reblogged this on sonofbluerobot.