Searching near a point
This exercise uses PDAL to find points near a given search location. Our
scenario is a simple one – we want to find the two points nearest the midpoint
of the bounding cube of our
interesting.las data file.
First we need to find the midpoint of the bounding cube. To do that, we need to
--all info for the file and look for the
pdal info ./exercises/info/interesting.las --all | jq .stats.bbox.native.bbox
Find the average the
x = 635619.85 + (638982.55 - 635619.85)/2 = 637301.20 y = 848899.70 + (853535.43 - 848899.70)/2 = 851217.57 z = 406.59 + (586.38 - 406.59)/2 = 496.49
With our “center point”, issue the
--query option to
and return the three nearest points to it:
pdal info ./exercises/info/interesting.las --query "637301.20, 851217.57, 496.49/3"
/3 portion of our query string tells the
command to give us the 3 nearest points. Adjust this value to
return data in closest-distance ordering.
--queryoption of info constructs a KD-tree of the entire set of points in memory. If you have really large data sets, this isn’t going to work so well, and you will need to come up with a different solution.