GithubHelp home page GithubHelp logo

Comments (3)

tombe-nm avatar tombe-nm commented on June 1, 2024 1

I tried merging the laz into one file and then running lidar tile gridding.

I get a constant shift north west throughout the raster compared to lastools output

image

from whitebox-tools.

vsydorov avatar vsydorov commented on June 1, 2024 1

Hi,

As you have correctly suspected it's a matter of whitebox-tools performing sampling in the corner of the pixel, instead of the center like lastools does. In my personal opinion, this is a bug, and the behaviour of lastools is to be preferred. When displaying the DEM in QGIS we can see that generated raster differs from the position of the original las points.

This is especially visible on the raster corners (Picture 1):
wbt_edge

Or when one interpolates at high enough resolution to see the mismatch between the TIN points and the underlying pointclouds (Picture 2):
tin_comparison

I've managed to fix for this for my own purposes by sidestepping this behaviour (or maybe we can call it a bug). I forcibly shift the points by half-a-resolution-step before processing them with the LidarTINGridding tool. This gives me results identical to las2dem outputs, bar numerical instabilities. Here is the code that works on my data which uses EPSG:32648 CRS. I use lastools to perform this shift and set a right bounding box, but I hope to find a solution using other opensource tools. I don't think WBT itself has the functionality needed to set the bounding box directly.

# *** How to create DTM at 0.5 that match between lastools and White Box Tools ***

# Put the .LAS into tight borders that we want in the resulting GTIFF
las2las -i "C387014760.las" -o "C387014760_tight.las" -auto_reoffset
lasinfo -i "C387014760_tight.las" -set_bounding_box 387000.00 1476000.00 12.00 387500.00 1476500.00 36.00

# = Creating C387014760_LT.tif in lastools  =
# Apply las2dem on this data, forcing high precision of elevation outputs to match WBT precision
las2dem -i "C387014760_tight.las" -keep_class 2 -step 0.5 -cpu64 -o "C387014760_LT.tif" -force_precision -float_precision 0.000001

# = Creating C387014760_WBT.tif in White Box Tools =
# Shift las points by half a resolution step
las2las -i "C387014760_tight.las" -o "C387014760_shifted.las" -translate_x -0.25 -translate_y +0.25
# Force the bounding box to match the previous tight box
lasinfo -i "C387014760_shifted.las" -set_bounding_box 387000.00 1476000.00 12.00 387500.00 1476500.00 36.00
# Apply WBT on shifted, tight data
whitebox_tools -v=true --compress_rasters=True --max_procs=32 --run=LidarTINGridding --input "C387014760_shifted.las" --parameter="elevation" --returns="all" --resolution=0.5 --exclude_cls="1" --max_triangle_edge_length=100.0 -o "C387014760_WBT.tif"

For the moment being I will use this trick to get proper TIN gridding with WBT

from whitebox-tools.

tombe-nm avatar tombe-nm commented on June 1, 2024 1

Thanks a lot for this. This works for me also.

However there is a very slight shift in the result on my end still due to the fact I have used a 0.5 step in lastools. (This ensures the edges between tiles are seemless.)

image

I am doing the transformation on the x and y in each as tile beforehand using laspy.

As my data is in feet and my required resolution is 3 so 1.5m shift. I am shifting:

                las.x += -4.92126 # Shift on the x-axis 
                las.y += 4.92126 # Shift on the y-axis 

To fix the step issue in the wb version. I round the XLLCORNER AND YLLCORNER. Eg:

NCOLS 2255
NROWS 844
XLLCORNER 804729.1
YLLCORNER 444923.72
CELLSIZE 3
NODATA_VALUE -32768.00

NCOLS 2255
NROWS 844
XLLCORNER 804729.0 #technically now XLLCENTER
YLLCORNER 444924.0 #technically now YLLCENTER
CELLSIZE 3
NODATA_VALUE -32768.00

Then I get perfect alignment:

image

Cheers Vlad

from whitebox-tools.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.