Create raster with values of classification of each point

113 views
Skip to first unread message

Glen Shennan

unread,
Jul 23, 2024, 7:45:57 AM7/23/24
to LAStools - efficient tools for LiDAR processing
Hi,

I need to create a raster where pixel values are the class values of the highest point in the raster cell. I'm assuming lasgrid is the way to go but I can't figure out the switches. Something like 

lasgrid64 -i *_height.las -step 0.5 -highest -otif -class_something_something

but I can't figure out what the final switch should be.

Jochen Rapidlasso

unread,
Jul 23, 2024, 11:13:13 AM7/23/24
to LAStools - efficient tools for LiDAR processing
Hi Glen,
there a solution to solve your task by coloring each cell by the highest point within a cell by the color of the class.

We take one of the LAStools sample files:
    lake.laz

lake_org.png
 37375  unclassified (1)
 27929  ground (2)
  2690  low vegetation (3)
  3772  medium vegetation (4)
 26934  high vegetation (5)
  3922  water (9)

The mayor step is done by thinning the points to one (highest) point per cell:

lasthin64 -i c:\lastools\data\lake.laz -o tmp1.laz -step 11 -highest

lake_thinned.png

Now we can use lasgrid64 to colorize this grid by classification:

lasgrid64 -i tmp1.laz -o tmp2.tif -step 11 -classification_majority -color_map map.csv

We use a color table to define our own colors for the occuring classes 1-5 and 9 using 8 bit RGB values:

colormap.txt
1 100 100 100
2 250 250 250
3 100 255 200
4  50 255  50
5   1 255   1
9 100 100 250    

Finally we check the result in QGIS.

qgis_check.jpg

Each input point leads to an output pixel in the resulting image.

Best regards,

Jochen @rapidlasso

Glen Shennan

unread,
Jul 24, 2024, 2:05:06 AM7/24/24
to LAStools - efficient tools for LiDAR processing
Yup, that works. Thank you very much!
Reply all
Reply to author
Forward
0 new messages