Python wrapper for laslib?

405 views
Skip to first unread message

Trigg

unread,
Jul 13, 2017, 2:35:57 AM7/13/17
to LAStools - efficient tools for LiDAR processing
Morning
would you know if it is feasible to generate wrappers over laslib so we can use our python scripting and automation with laz files?  Perhaps SWIG could be used to auto generate a wrapper.  Python 3.x would seem to be a good destination

Python is fast becoming the #1 scripting and programming language for both server and cloud based developments as it is really flexible.  Both environments are ideally placed for processing of massive pointclouds using lastools.  Providing a slick interface between laz and python would be a significiant benefit for lastools.

Writing out ASCII files so lastools can import them is inefficient, clunky and should be illegal.

regards
pk


J Luis

unread,
Jul 13, 2017, 9:39:26 AM7/13/17
to LAStools - efficient tools for LiDAR processing
There is one wrapper for the Julia language.

https://github.com/joa-quim/Laszip.jl

Joaquim

Darcy Vaughan

unread,
Jul 13, 2017, 3:30:34 PM7/13/17
to last...@googlegroups.com

I would second this request. 

 

While perhaps this is an argument against adding a Python wrapper J  – python is also the scripting language for the ESRI tools.  This along with its rapid much broader acceptance makes it a logical choice. 

 

Regardless, it is a great toolset.  Keep up the good work.

 

dv

Trigg

unread,
Jul 14, 2017, 1:17:40 AM7/14/17
to LAStools - efficient tools for LiDAR processing
Hi Darcy,
I this use case, I am not aiming on the ESRI platform. Interaction with ESRI scripting would be a nice extra benefit.  In my use cases, I would like to write out laz files from the results of mass data processing engine which is python based.  I know we can shell las2las, and this works in a clunky mechanism via ASCII files, or stdin at a push, but its not a particularly elegant design.

If this can be done for Julia, I suspect it is possible for python, I just have no idea where to start!

pk

J Luis

unread,
Jul 14, 2017, 2:18:24 PM7/14/17
to LAStools - efficient tools for LiDAR processing
I never tried this (calling Julia from Python). Not the cleanest but it might work.

https://github.com/JuliaPy/pyjulia

Howard Butler

unread,
Jul 17, 2017, 12:49:29 PM7/17/17
to last...@googlegroups.com
Don't use SWIG. As someone with 15 years of SWIG experience maintaining the GDAL and MapServer bindings, don't use SWIG. If you must, hand roll some bindings with Cython or ctypes. Exposure of all of LASlib would require a lot of effort, however.

There is a branch that I wrote for both laspy https://github.com/laspy/laspy/commits/lazperf-decomp and laz-perf https://github.com/hobu/laz-perf that allows in-memory decompression of LAZ data. It is really rough, but it is one way to a (almost) pure Python LAZ experience. Some investment would be required to get this smooth, however.

PDAL also has an excellent Python story https://www.pdal.io/python.html and it is the easiest way to get from LAZ -> NumPy arrays at the moment. PDAL allows you to embed Python scripts as part of a processing chain (embed), and it allows you to invoke a processing chain and grab its results as a NumPy array (extension). The embed part is available through the OSGeo4W64 packaging system on Windows, and if there is interest, I could push up the extension for that distribution as well. It should all Just Work™ on Linux or OSX. See one of the PDAL Workshop examples for some ideas on how it can be used https://www.pdal.io/workshop/exercises/python/histogram.html

Howard
Reply all
Reply to author
Forward
0 new messages