How can I update the geolocation when creating a .las file using pylas?

240 Views Asked by At

pylas community! I am relatively new to pylas but I have experience working with web-based graphics/geospatial engines and a variety of 3D data types.

In a project that I am currently working on, I am reading in data from the Mapillary API and exporting it as a .las file. I am able to do this successfully and even got some nice results.

However, I am struggling to add a geolocation to the data that I export. The current .las file that I am creating does not have a geolocation. Thus, I am updating the location manually to get the desired result. What part of the pylas API should I be using to accomplish this? Thank you!

Here is the code that I have written so far:

# LAS point format 2 supports color
header = laspy.header.Header(point_format=2)
with laspy.file.File(filename, mode="w", header=header) as lasfile:
    # lasfile.header.offset = header.offset
    lasfile.header.scale = [1.0, 1.0, 1.0]
    # updating coordinates
    lasfile.x = np.array(x)
    lasfile.y = np.array(y)
    lasfile.z = np.array(z)
    # updating RGB
    lasfile.red = r
    lasfile.green = g
    lasfile.blue = b
0

There are 0 best solutions below