problem in reading las file using liblas and laspy in python

1.2k Views Asked by At

I pip installed liblas, which got installed perfectly, but still, when I'm trying to import liblas it's raising an error which is shown in the 1st error.

then I pip installed laspy, which installed perfectly and tried to read my las file from that using laspy.file.File, but again it raised me an error which is shown in the 2nd error

OSError                                   Traceback (most recent call last)
<ipython-input-6-7ba94c832967> in <module>
----> 1 import liblas

C:\ProgramData\Anaconda3\lib\site-packages\liblas\__init__.py in <module>
      1 #from .core import *
----> 2 from .core import get_version
      3 from .core import las
      4 version = get_version()
      5 HAVE_GDAL = bool(las.LAS_IsGDALEnabled())

C:\ProgramData\Anaconda3\lib\site-packages\liblas\core.py in <module>
    137         original_path = os.environ['PATH']
    138         os.environ['PATH'] = "%s;%s" % (local_dlls, original_path)
--> 139         las = ctypes.CDLL(lib_name)
    140 
    141         def free(m):

C:\ProgramData\Anaconda3\lib\ctypes\__init__.py in __init__(self, name, mode, handle, use_errno, use_last_error)
    354 
    355         if handle is None:
--> 356             self._handle = _dlopen(self._name, mode)
    357         else:
    358             self._handle = handle

OSError: [WinError 126] The specified module could not be found
LaspyException                            Traceback (most recent call last)
<ipython-input-5-20f5fbf35bba> in <module>
----> 1 inFile = File('2_DLL.las', mode='r')

C:\ProgramData\Anaconda3\lib\site-packages\laspy\file.py in __init__(self, filename, header, vlrs, mode, in_srs, out_srs, evlrs)
     62         self.in_srs = in_srs
     63         self.out_srs = out_srs
---> 64         self.open()
     65 
     66     def open(self):

C:\ProgramData\Anaconda3\lib\site-packages\laspy\file.py in open(self)
     73             ## Make sure we have a header
     74             if self._header is None:
---> 75                 self._reader = base.Reader(self.filename, mode=self._mode)
     76                 self._header = self._reader.get_header()
     77             else:

C:\ProgramData\Anaconda3\lib\site-packages\laspy\base.py in __init__(self, filename, mode, header, vlrs, evlrs)
    271         self.padded = False
    272         if self.mode in ("r", "r-"):
--> 273             self.setup_read_write(vlrs,evlrs, read_only=True)
    274             return
    275         elif self.mode == "rw":

C:\ProgramData\Anaconda3\lib\site-packages\laspy\base.py in setup_read_write(self, vlrs, evlrs, read_only)
    300         self.data_provider.open(open_mode)
    301         self.data_provider.map()
--> 302         self.header_format = laspy.util.Format("h" + self.grab_file_version())
    303         self.get_header(self.grab_file_version())
    304         self.populate_vlrs()

C:\ProgramData\Anaconda3\lib\site-packages\laspy\util.py in __init__(self, fmt, overwritable, extra_bytes, extradims)
    150                         "EVLR", "h1.0", "h1.1", "h1.2", "h1.3", "h1.4",
    151                         "extra_bytes_struct", "None")):
--> 152             raise LaspyException("Invalid format: " + str(fmt))
    153         if self.fmt == None:
    154             return

LaspyException: Invalid format: h82.83
1

There are 1 best solutions below

0
On

Pre-requisites The Python bindings require the libLAS base C and C++ libraries be installed. Obtain a source copy of the library from http://liblas.org/download.html and follow the compilation instructions at http://liblas.org/compilation.html to build and install the library.