jblindsay / whitebox-tools

An advanced geospatial data analysis platform
https://www.whiteboxgeo.com/
MIT License
967 stars 161 forks source link

Adding more options for LiDAR Interpolation #43

Closed rsjones94 closed 5 years ago

rsjones94 commented 5 years ago

Are there any plans to allow the LiDAR interpolation functions to use any arbitrary field rather than what is currently available ('elevation', 'intensity', 'class', 'scan angle', 'user data'). The interpolation functions work great, but it would be helpful to be able to apply them to e.g., the number of returns per pulse (to get average number of returns per pulse in a cell), or to the RBG fields (in order to extract a color image) without having to write more code to bin these values. Right now the only way to do this is to trick the function by changing e.g., swapping the headers for Z and number of returns.

jfprieur commented 5 years ago

If I may piggyback on this, it would be great to be able to select the cell assignment type in lidar_tin_gridding to maximum for example. I believe it currently assigns the minimum (or average) value in the cell to the pixel. It leads to more 'pitting' in the DSM for our purposes. I attach two images to compare. This is lidar data from a Leica SPL100 single photon system and the dataset has high point density so permits the generation of 25cm surface rasters

DSM made with wbt using

wbt.lidar_tin_gridding(
parameter="elevation", 
returns="first", 
resolution=0.25)

IMAGE 1

wbt

DSM made with ArcMap (LAS Dataset to Raster, maximum cell assignment, natural neighbour void filling method (which should not matter at the point densities involved in this case))

IMAGE 2

arc

Information for a specific cell.

layer ending in _buf20_DSM is wbt generated DSM (image 1) layer ending in DSM is provider generated DSM test is one of 4 lidar points in 25cm raster cell test_first is ArcMap generated DSM (image 2)

1

jblindsay commented 5 years ago

@rsjones94 I can see about adding these features to the interpolation. RGB will admittedly be a bit tricky to do. As for now though, if you want the average number of returns per pulse for a cell, you can use the LidarPointStats tool.

jblindsay commented 5 years ago

@jfprieur I'm not quite sure what you mean be the maximum value. The LidarTinGridding tool doesn't choose the minimum, mean, or maximum in the cell. It fits a triangulation to the points and then uses the planar equation of each triangular facet to interpolate (linearly) the value of the distribution at the set of grid cell centres. Also, are you aware of the LidarBlockMinimum and LidarBlockMaximum tools? If you have further issues/requests, I'd ask that you open a dedicated issue separate from this thread.

jfprieur commented 5 years ago

Thank you for the quick reply, I should have looked at the documentation more thoroughly (I did look I swear!), of course the tin_gridding tool functions like its name ;) I should have noticed that.

The BlockMinimum and BlockMaximum tools seem to do exactly what I want. Sorry for the confusion.

jblindsay commented 5 years ago

@jfprieur No problem. I do certainly need to improve the documentation for many of the LiDAR tools to make it easier for users like yourself to know which tool does what. I'm working on it but the list of things to do is ever expanding and time is ever contracting...

jblindsay commented 5 years ago

@rsjones94 Okay, I just committed code to allow for interpolating the return number, number of returns, and the RGB colour information of points to the LidarTinGridding, LidarIdwInterpolation, and LidarNearestNeighbourGridding tools. To be clear however, because these are interpolation tools, that estimate the value of the underlying distribution at the grid cell centre points (i.e. a point value rather than an area value), you still won't be able to estimate the average number of returns per pulse within a grid cell using these data. While you could always have calculated this statistic using the number of points and number of pulse rasters output from the LidarPointStats tool, I have also updated this tool with this commit to include an additional 'average number of points per pulse' output to make it easier (i.e. it saves you have to divide the one output raster by the other.

I have not had a chance to test these new features as I don't have ready access to a LAS file containing colour information. If you get a chance to test them sometime, please let me know if you run into any issues. In the meantime, I am going to close this issue as resolved. Note, the new features won't be available until I release the next public release of WhiteboxTools, unless you build from source.

rsjones94 commented 5 years ago

Awesome! Thanks for your work on this this; WBT is a wonderful tool for many people