I ran into another problem when applying my workaround to large LAS files. The issue is noted at the github page for laspy here: https://github.com/grantbrown/laspy/issues/51 This builds on an earlier post at: Update EVLR header info for .LAS file using laspy

My method shown at the post above works for smaller LAS files (tested on files up to 800MB), but fails on larger files (fails on a file 6.2GB in size).

The issue seems to be the file byte offset integer value (where the EVLR content is to be placed) is too large for laspy (using version 1.2.5 with python version 2.7.12 64-bit) to convert to a C long value.

My error stack trace looks like this:

Traceback (most recent call last):

File "C:\Projects\LASPY_EVLR\writeEVLR.py", line 112, in <module>
File "C:\Projects\LASPY_EVLR\writeEVLR.py", line 103, in main
outFile_v14.header.evlrs = old_evlrs
File "C:\Users\am\AppData\Local\Continuum\Anaconda2\envs\lidartools\lib\site-packages\laspy\header.py", line 1146, in set_evlrs
File "C:\Users\am\AppData\Local\Continuum\Anaconda2\envs\lidartools\lib\site-packages\laspy\base.py", line 848, in set_evlrs
dat_part_1 = self.data_provider.fileref.read(old_offset)

OverflowError: Python int too large to convert to C long

Digging deeper, I found that the offset value for the beginning of the EVLR content is set to a value of 6,440,746,607 or about 6.44e9. I know this WILL fail to be converted to a double, but I'm not sure about C long types.

If this is a 32-bit unsigned long integer, then the conversion won't work... Is it possible to make this a 64-bit unsigned long integer? It looks like the max 32-bit unsigned long integer value is: 4,294,967,295.

This is a very large LAS file, though we have tons more of this size. This LAS file has 214691510 points.

I'm setting the "start_first_evlr" property to the end of the input file (when there are no EVLRs present) in the code from my previous post:

endofthefile = theDataProvider._mmap.size()
outFile_v14.header.start_first_evlr = endofthefile

Then when I set the updated EVLR content, the Overflow Error shows up:

outFile_v14.header.evlrs = old_evlrs

Do you have any workaround suggestions for me?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.