Closed runette closed 3 years ago
Can you verify that it doesn't leak PDAL objects?
I am not aware of any leaks and tried to follow the existing Array structure as closely as possible - but as usual I don't know what I don't know!
Please add a test that does filters.delaunay
on https://github.com/PDAL/python/blob/master/test/data/1.2-with-color.las and tests that you get what you expect. With that, I think we're good to merge.
Please add a test that does
filters.delaunay
on https://github.com/PDAL/python/blob/master/test/data/1.2-with-color.las and tests that you get what you expect. With that, I think we're good to merge.
Will do - probably tomorrow
@hobu Added tests and documentation
2.4.0 pushed https://pypi.org/project/PDAL/
Adds the ability to access face data from meshes in the Python API:
pdal.Pipeline
calledget_meshes()
that returns a list ofndarray
in the same format asget_arrays()
. Eachndarray
represents one mesh from onePointView
and is a (1, size) array of Triangles, where each triangle is a tuple of(index of corner a, index of corner b, index of corner c)
- the index referring to the points inPointView
array.libpdalpython.pyx
to implement the above,Pipeline
class calledgetMeshes()
that returns a vector of PyMeshPyMesh
very much a copy of thePyArray
class, in this case the class creates the mesh ndarray.All of the above is working on my builds and does not introduce any new dependencies. However, I also wanted to create a way to create a useable Mesh object easily.
NOTE - where there is no mesh attached to the
PointView
,get_meshes
will return an ndarray with 0 rows to ensure that the correspondence between arrays and meshes can be retained.One good way of doing that is using the Meshio package - which allows the Mesh object to be re-used by a wide range of other packages.
So - I have also included the following :
pdal.Pipeline
calledget_meshio(idx: int) -> meshio.Mesh
. This usesget_meshes
andget_arrays
to create a Mesh object. At the moment it does not add the non-geometry data (a ToDo). This method requiresmeshio
and if it is not installed will fail with an informative error.Usage
The simplest usage would look like the following:
NOTE that since we are getting back a vector of meshes - we can do something that was not easy before and was actually the use-case that I needed to solve:
USE-CASE : Take a LiDAR map, create a mesh from the ground points, split into tiles and store the tiles in PostGIS.
(example using 1.2-with-color.las and not doing the ground classification for clarity)
This creates 24 tile meshes in PostGIS