I am trying to make a copy of a LAS file while inserting new points using python liblas module. The code below creates the copy and adds the points, but for some reason the added points are not in the correct location. Also, it seems that x, y, z values are being stored int instead of float values. Can anyone explain why I am having this problem? Thanks in advance for your help.
import liblas from liblas import file as lasfile las_file = r"path here" out_las = r"path here" # Read las file f = lasfile.File(las_file, mode='r') h = f.header # Open file to write to, using original header fout = lasfile.File(out_las, mode='w', header=h) counter = 0 for p in f: if counter != 0: # Code to Interpolate # x, y, z for new point # from existing points vD = (new_x, new_y, new_z) # vD is tuple of floats new_pt = liblas.point.Point() # Create Point object new_pt.x = vD # Set x property new_pt.y = vD # Set y property new_pt.z = vD # Set z property fout.write(new_pt) # Write new_pt to fout # Write p to fout, retaining original properties fout.write(p) counter += 1 fout.close()