I want to append XYZI values row after row into a las file.How to do this? I'm using python laspy library to write XYZI points at once, but i want to append row after row using a loop.

The points are in SQLite db I need to generate a .LAS file(v1.3 and v1.4).I get memory error as the db grows large.

i'm doing this

import laspy

header = laspy.header.Header()
outfile = laspy.file.File("output.las", mode="w", header=header)
outfile.X = read column1 from db
outfile.Y = read coulmn2 from db
outfile.Z = read column3 from db


  • Which software do you want to use? Do you require it to be row after row really? Does it have to be from within Python code? Bit more information would be a good idea :) Feb 13, 2019 at 9:37
  • 1
    @bugmenot123 is there anyway to write millions(las file of size 15gb) of points at once ?
    – Stark
    Feb 13, 2019 at 9:40
  • Depends what you mean by "at once". If it is really just converting XYZI to LAS, I would use the las2las tool. Feb 13, 2019 at 9:42
  • Sorry i'm new here. I have to write a script to read points from SQLite db and create a .LAS file.
    – Stark
    Feb 13, 2019 at 9:46
  • Ah, that makes it clearer. Hm, sadly the laspy documentation does not cover a case like that. Maybe ask on their github.com/laspy/laspy/issues ? With pdal this looks promising pdal.io/stages/readers.sqlite.html but also leaves a lot to guess/read. Good luck and if you find a way, remember to post it here! Hopefully someone can help you :) Feb 13, 2019 at 13:25

1 Answer 1


Yogi,You can check here -https://github.com/laspy/laspy/commit/4dba4c846eacf119b5e99ccf8ccae73735ef1944. You need to write the points to an numpy array first and then write the array(X's, y's and Z's) to the file.

Read a few million points at a time and make smaller las files that you can eventually join together to make a much more massive file.

If you make smaller "tiles" you can merge them with Whiteboxtools LidarJoin - https://jblindsay.github.io/wbt_book/available_tools/lidar_tools.html#LidarJoin.

  • 1
    Thank you @Cary H I have done the same and used python-pdal library to merge
    – Stark
    Jun 3, 2019 at 9:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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