Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

lasgrid image sizes are not same even using same source laz

43 views
Skip to first unread message

Jukka Inkeri

unread,
Feb 4, 2025, 9:39:11 AMFeb 4
to LAStools - efficient tools for LiDAR processing

I'm working with a LAZ file, r.laz, available at https://awot.fi/tmp/laz/r.laz.

I'm generating PNG images representing different vegetation classes (3, 4, and 5) from this LAZ file. However, I've noticed that the resulting PNG images have different dimensions.

My goal is to create a single, merged image with these classes as separate layers: class 5 at the bottom, class 4 above that, and class 3 at the very top. Any areas not covered by these classes should be transparent.

I can easily generate individual PNG images for each class using lasgrid64:

lasgrid64 -i r.laz -keep_class 3 -set_RGB 61 255 0 -rgb -step 2 -o r.3.png
lasgrid64 -i r.laz -keep_class 4 -set_RGB 110 255 61 -rgb -step 2 -o r.4.png  
lasgrid64 -i r.laz -keep_class 5 -set_RGB 173 255 135 -rgb -step 2 -o r.5.png 

My primary question is: How can I ensure that all the generated PNG images have the exact same dimensions so that they can be correctly layered using ImageMagick's convert command?

Is there a way to accomplish this layering directly within LAStools, perhaps using a colormap or other functionality, without having to rely on external tools like ImageMagick?


Jochen Rapidlasso

unread,
Feb 4, 2025, 4:00:22 PMFeb 4
to LAStools - efficient tools for LiDAR processing
Hi Jukka,
probably there are several ways to go.
The problem is that your read filter (-keep_class...) will take affect on the reader, so we do not have all points we need for the raster dimensions.
One option is to use TIFF as output where we have a absolute position in the TIFF header.
The option if you prefer PNG is probably the "-use_bb" argument:
      -use_bb                    : raster full extend of bounding box
There we raster the full size based on the header informations. The output seems to be what you want to have.

Cheers,

Jochen @rapidlasso

Jukka Inkeri

unread,
Feb 5, 2025, 4:58:34 AMFeb 5
to LAStools - efficient tools for LiDAR processing
Thanks. I tried to read README ... and tried to find some bounding rule, but I was "blind".

This worked fine:
# low forest
lasgrid64 -i r.laz -use_bb -keep_class 3 -subcircle 0.05 -set_RGB 37 153 0 -rgb -step 2 -o r.c.png   
# middle
lasgrid64 -i r.laz -use_bb -keep_class 4 -subcircle 0.05 -set_RGB 110 255 61 -rgb -step 2 -o r.b.png  
# highest
lasgrid64 -i r.laz -use_bb -keep_class 5 -subcircle 0.05 -set_RGB 173 255 135 -rgb -step 2 -o r.a.png  

And then to one file, example using Magick convert command:

convert r.?.png  -background white -layers merge  r.all.png
cp  r.a.pgw r.all.pgw

-jukka-
Reply all
Reply to author
Forward
0 new messages