[pdal] pdal.pipeline.array to 2D np.ndarray
Lothar Ulferts
l.ulferts at hs-osnabrueck.de
Wed Sep 5 06:34:44 PDT 2018
Hy,
I want to transform the points of multiple LAS files from cartesian
coordinates to polar coordinates. The transformation is done with numpy
in a two-dimensional /numpy.ndarray/.
But how do I get a 2D numpy.ndarray from the data of the PDAL pipeline
(in the PDAL Python example the /pipeline.arrays/ )? From the PDAL
Python example I changed the JSON expression:
pipe_reader = """
{
"pipeline":[
{
"type":"readers.las",
"filename":"%s"
}
]
}
}"""%lasinput
/pipeline.arrays/ does not return an array, but a /list/ containing a
one-dimensional /numpy.ndarray/. Each row of this array is a
/numpy.void/ with the values of a point. My current solution is a
listcomprehension:
arr_voids = arrays[0]
points = np.array([list(i) for i in arr_voids], dtype= arr_voids.dtype)
This way is too slow, too memory intensive and not a "numpyical-way".
But how do I get there with numpy or pdal? Perhaps I‘ve already chosen
the wrong approach?
Thanks!
Lothar
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/pdal/attachments/20180905/a1512cde/attachment.html>
More information about the pdal
mailing list