1

I am trying to learn LASPY and am running into road blocks off the bat. I first ran into and Error 8 (Not enough storage is available to process this command) using my full sized LAS file (1.7GB). I was able to get around it by using FUSION's polyclipdata to create multiple smaller sized LAS files; just frustrating. The second road block I have run into, and I can't find out much about it, is:

ValueError: buffer size must be a multiple of element size

when I try:

import laspy
import numpy as np
from laspy import file
infile = file.File("F:/P834/temp/pointfile3_2.las", mode="r")

Error occurs on line 4.

I am trying to work through the tutorial http://laspy.readthedocs.io/en/latest/tut_part_1.html

What am I missing in my early start?

Full error printout:

Traceback (most recent call last):
  File "F:/P834/laspy/laspy_tests.py", line 2, in <module>
    infile = laspy.file.File('F:/P834/temp/pointfile3_2.las', mode='r')
  File "C:\Python27\ArcGIS10.3\lib\site-packages\laspy\file.py", line 64, in __init__
    self.open()
  File "C:\Python27\ArcGIS10.3\lib\site-packages\laspy\file.py", line 75, in open
    self._reader = base.Reader(self.filename, mode=self._mode)
  File "C:\Python27\ArcGIS10.3\lib\site-packages\laspy\base.py", line 273, in __init__
    self.setup_read_write(vlrs,evlrs, read_only=True)
  File "C:\Python27\ArcGIS10.3\lib\site-packages\laspy\base.py", line 321, in setup_read_write
    self.data_provider.point_map()
  File "C:\Python27\ArcGIS10.3\lib\site-packages\laspy\base.py", line 163, in point_map
    offset=self.manager.header.data_offset)
ValueError: buffer size must be a multiple of element size
Aaron
  • 51,658
  • 28
  • 154
  • 317
D_C
  • 1,359
  • 10
  • 23
  • Are you importing the tiled las data from FUSION? – Aaron Feb 28 '18 at 16:32
  • I tiled the data using fusion in the command prompt. The only code in my python window currently is what is displayed above. – D_C Feb 28 '18 at 16:33
  • 1
    In other words, using laspy, are you trying to import a tiled las file that was created using FUSION? – Aaron Feb 28 '18 at 16:35
  • Yes. This is the first part of the tutorial and I couldn't get past the memory error without tiling. – D_C Feb 28 '18 at 16:36
  • 2
    You may be trying to import a corrupted file. Try importing another las file using laspy to see if your tiled las data is in fact corrupted: http://matsu.gina.alaska.edu/LiDAR/Caswell_Lakes/Point_Cloud/Classified/CL_001_NE_PtCl.las – Aaron Feb 28 '18 at 16:38
  • 1
    That file worked, i can see the results.... how do I do this for my larger dataset? – D_C Feb 28 '18 at 16:43
  • Now, we have to figure out why FUSION corrupted your file during the tiling process. That may be a question in and of itself... – Aaron Feb 28 '18 at 16:46
  • As a side note, I have been enjoying working with the R lidR package recently and would recommend it over laspy. It is highly optimized for working with point cloud data with an emphasis on forestry applications. – Aaron Feb 28 '18 at 16:51
  • I will look into R, I have no experience with it currently. I am looking for the best (and easiest) method to learn to get at the data in LAS files for exactly that: forestry applications. I have placed the FUSION question here: https://gis.stackexchange.com/questions/273053/fusion-polyclipdata-creates-corrupt-las-file – D_C Feb 28 '18 at 16:55
  • 1
    Great, thanks for opening a new question. I would recommend either adding your own answer to this question (e.g. I was working with corrupt data) or closing this question so that we can consider this question resolved. Also, if you are interested in the lidR package, check out @JRR's github page which has many tutorials: https://github.com/Jean-Romain/lidR – Aaron Feb 28 '18 at 17:00

2 Answers2

2

As determined while working through the problem with Aaron, I figured out I was working with corrupt data, because applying the same code to other .las file worked (here is the alternative file used).

I have opened another question related to why FUSION is creating corrupt data when using the polyclipdata module here: FUSION polyclipdata creates corrupt LAS file

Andre Silva
  • 10,259
  • 12
  • 54
  • 106
D_C
  • 1,359
  • 10
  • 23
1

I ran into the same error with las files containing EXTRA_BYTE information generated with lasheight from LAStools. After removing the EXTRA_BYTE information laspy had no issue to open the files.

zwnk
  • 390
  • 3
  • 12