# Finding the boundary

This exercise uses PDAL to find a tight-fighting boundary of an aerial scan. Printing the coordinates of the boundary for the file is quite simple using a single `pdal info` call, but visualizing the boundary is more complicated. To complete this exercise, we are going to use QGIS to view the boundary, which means we must first install it on our system.

## Exercise

Note

We are going to run using the Uncompahgre data in the `./density` directory.

    1
    2
    3

    pdal info ^
        c:/Users/hobu/PDAL/exercises/analysis/density/uncompahgre.laz ^
        --boundary

… a giant blizzard of coordinate output scrolls across our terminal. Not very useful.

Instead, let’s generate some kind of vector output we can visualize with QGIS. The `pdal tindex` is the “tile index” command, and it outputs a vector geometry file for each point cloud file it reads. It generates this boundary using the same mechanism we invoked above – filters.hexbin. We can leverage this capability to output a contiguous boundary of the `uncompahgre.laz` file.

    1
    2
    3
    4

    pdal tindex ^
        --tindex c:/Users/hobu/PDAL/exercises/analysis/boundary/boundary.sqlite ^
        --filespec c:/Users/hobu/PDAL/exercises/analysis/density/uncompahgre.laz ^
        -f SQLite

Once we’ve run the tindex, we can now visualize our output:

Open QGIS and select Add Vector Layer:

Navigate to the `exercises/analysis/boundary` directory and then open the `boundary.sqlite` file:

## Notes

1. The PDAL boundary computation is an approximation based on a hexagon tessellation. It uses the software at http://github.com/hobu/hexer to do this task.
2. filters.hexbin can also be used by the density to generate a tessellated surface. See the Visualizing acquisition density example for steps to achieve this.
3. The tindex can be used to generate boundaries for large collections of data. A boundary-based indexing scheme is commonly used in LiDAR processing, and PDAL supports it through the `tindex` application. You can also use this command to merge data together (query across boundaries, for example).