Monday, December 3, 2018

Use PDAL to export colored LAS file to Point Cloud XYZ format text file

PDAL can be used to export out a colored laser LAS file like the one in the screenshot below into a text file in Point Cloud XYZ format, which is just an ASCII text file with each point in a row of X, Y, Z, R, G, B values.

To use PDAL to perform the conversion, follow the following steps.
  1. In Windows, open up an OSGeo4W Shell.


  2. In the command prompt, change directory to the folder containing the LAS file e.g. D:\Temp\data\.

  3. Use a text editor to create a PDAL pipeline JSON file, e.g. las2xyz.json, with the following contents.

    {
      "pipeline":[
        {
          "type":"readers.las",
          "filename":"color.las"
        },
        {
          "type":"writers.text",
          "format":"csv",
          "order":"X,Y,Z,RED:0,GREEN:0,BLUE:0",
          "keep_unspecified":"false",
       "quote_header": "false",
       "delimiter": " ",
          "filename":"outputfile.xyz"
        }
      ]
    }
    

    where color.las is the name of the input LAS file
    and outputfile.xyz is obviously the name of the output XYZ file.
  4. In the command prompt, type in the following command to perform the conversion.

    D:\> pdal pipeline las2xyz.json
  5. Press Enter.

    The X, Y, Z, R, G, B values of the LAS file are exported out into the text Point Cloud XYZ file.
Related Posts with Thumbnails