1

I'm trying to use lidar point X, Y, and Z coordinates (from .las files) in calculations. I'm using Python 2.7.13 (x64), with laspy 1.5.0.

Reading attributes one at a time with the following is amazingly fast:

inFile = laspy.file.File(las_file, mode="r")

x = inFile.X

But things slow down considerably when concatenating different single-attribute ndarrays into one array with the following (for example, when getting nx3 array of positions):

coords = np.array((inFile.X, inFile.Y, inFile.Z)).transpose()

I see in Inserting LiDAR points (from laspy) in GeoDataFrame without using a numpy array? that getting inFile.X, inFile.Y, and inFile.Z is as fast as it is because they're numpy-wrapped memory views with little copying going on.

Is there a way to create numpy-wrapped memory views containing multiple attributes, so time doesn't need to be spent copying multiple single attributes to one array, on top of doing something with that array?

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.