# Searching near a point

## Exercise

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 print the `--all` info for the file and look for the `bbox` output:

```pdal info ./exercises/info/interesting.las --all | jq .stats.bbox.native.bbox
``` Find the average the `X`, `Y`, and `Z` values:

```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 `pdal info` and return the three nearest points to it:

```pdal info ./exercises/info/interesting.las --query "637301.20, 851217.57, 496.49/3"
```

Note

The `/3` portion of our query string tells the `query` command to give us the 3 nearest points. Adjust this value to return data in closest-distance ordering. 