filters.delaunay) create TIN type mesh data. This data can be accessed in Python using the Pipeline.meshes property.
Accessing mesh data with Pipeline.meshes
ThePipeline.meshes property returns a numpy.ndarray of shape (1,n) where n is the number of triangles in the mesh.
If the PointView contains no mesh data, then n = 0.
Like
Pipeline.arrays, Pipeline.meshes returns a list of numpy.ndarray to provide for the case where the output from a Pipeline is multiple PointViews.Triangle structure
Each Triangle is a tuple(A,B,C) where A, B and C are indices into the PointView identifying the point that is the vertex for the Triangle.
Meshio integration with get_meshio()
The meshes property provides the face data but is not easy to use as a mesh. Therefore, PDAL Python provides optional integration into the Meshio library. Thepdal.Pipeline class provides the get_meshio(idx: int) -> meshio.Mesh method. This method creates a Mesh object from the PointView array and mesh properties.
Simple example
Advanced mesh use case
The following example demonstrates a real-world use case: Take a LiDAR map, create a mesh from the ground points, split into tiles and store the tiles in PostGIS.This example uses 1.2-with-color.las and does not perform ground classification for clarity.
- Reads a LAS file
- Splits the point cloud into 1000-unit tiles using
filters.splitter - Creates a Delaunay triangulation mesh for each tile
- Iterates through each mesh, converts it to WKT format using meshio
- Inserts each mesh into a PostGIS database as a geometry