I have text file with point cloud data in UTM format, say

sample=[632535.222, 4858488.332, 150.555]

I am currently using laspy, the parsing from txt is ready, and I plan to generate a new las file using the following code:

header = laspy.LasHeader(point_format=0, version="1.3")
outfile = laspy.LasData(header)
outfile.x = utm_east
outfile.y = utm_north
outfile.z = utm_z
outfile.intensity = raw_intensity

I am getting the error message:

ValueError: invalid literal for int() with base 10: '632535.331'

which obviously because I am trying to store a float point into 32bit signed int as data format for LAS file.

Is there any way I can get around this with while retaining the precision of the result here? Even with scaling I think it goes beyond the maximum for 32bit int.

1 Answer 1


You must define a scale factor and an offset. I do not know python and laspy but according to the doc it should look like

header.offset = [632000, 4858000, 0]
header.scale = [0.001, 0.001, 0.001]
  • That looks viable. I will certainly give it a try. I was going to save the offset for the latitude and longitude value.
    – Bogdan
    Dec 5, 2021 at 19:15
  • 1
    It is not "viable". This the way LAS format is designed asprs.org/wp-content/uploads/2019/07/LAS_1_4_r15.pdf
    – JRR
    Dec 5, 2021 at 20:20
  • I really appreciate this piece of info. Never used LAS before and really need the basics.
    – Bogdan
    Dec 6, 2021 at 16:06
  • Added some basic if statements so numbers work out in its data format.
    – Bogdan
    Dec 10, 2021 at 16:28

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.