Applied-GeoSolutions / lidar2dems

Utilities using PDAL and PCL to create DTMs, DSMs, and CHMs from lidar data
89 stars 36 forks source link

Problem creating DEMS with pre-classified LAS file #27

Open stephenhagen opened 9 years ago

stephenhagen commented 9 years ago

Email trail:

Hi Steve

This is Yang who just started working with Nate at AGS. Diya just helped me to ask you a question on the site shapefile in order to run the l2d_dems. I'm still not sure how to work around this issue.

Here is the problem. There is an input option for l2d_dems, which is the site shapefile. The default is NONE, meaning no site file is provided. However, when I run the command, an error pops up saying the "site.Basename()" cannot be called since " 'NoneType' object has no attribute 'Basename' ".

It seems that if l2d_dems is not able to handle this non-shapefile scenario. If a site shapefile is indeed needed, how can I get one for the particular LAS data (e.g. 19_03324794.las) I downloaded from GRANIT? The only information I know for this data is that it is a 13MB data for the town of Rochester.

Thanks for the clarification.

Yang

Steve's reply:

Here is one suggested work around: you can use a command called "lasinfo" on the file to get the corner points and create a shapefile from these corner points. Sorry about the inconvenience. I'll post that as a bug and see if we can get it fixed to run without a shapefile. In the meantime, try my suggestion.

Hi Steve

I've used a shapefile as an input and tested the DSM command over one LAS data in Rochester. Below is the error message, which says "No valid LAS files found!" however in the directory "data_files", there is indeed one .las file as you can see below. Please help. Thanks for your time.

ylei@rio:~/coastal-classified-las-2011/data_files$ ls 19_03324794.las ylei@rio:~/coastal-classified-las-2011/data_files$ cd .. ylei@rio:~/coastal-classified-las-2011$ l2d_dems dsm data_files/ -s Rochester_lidar_polygon.shp --outdir dems --maxsd 2.5 --maxz 400 --maxangle 20 --gapfill No valid LAS files found!

Frankie's view: It uses one of two functions - if the output is for a density image, it uses a function called find_lasfiles and generates a list of all las files in the las directory.

However, if it is not density, it looks for the classified las files using find_classified_lasfile (also in utils.py), which have a particular naming convention if the whole process is done using lidar2dems - it really should return a list of all files in a directory we point to that might be known to hold classified files even if it doesn't hold the same naming convention, but at this point it appears that if the files don't carry the naming convention that we prescribe in classify.py, then it returns an empty file list and an error ("No classified LAS files found"). I'm guessing this is the updated error description that hasn't been pulled to rio...? Next paragraph has more details.

As for the specific error: "No valid LAS files found!" -- I actually can't find this exact error anywhere in the code where I would expect it to be. I know that the updates for the code haven't been pulled for rio at least since yesterday, when I pushed an update. I think it's time that an update gets pulled, but I haven't heard from Matt since I emailed him yesterday. After that, Yang should try to re-run the script, and if it fails we'll have to dig again...

In general, for the most useful functionality, we should have the whole software written up in a way that doesn't necessarily require a site shapefile - in other words, it should classify data piecemeal, make the dems for each tile and then throw them together. One way to do this might be to generate a pseudo site shapefile if one isn't provided, so that it works on each tile as if it were a "feature" in which case it would probably use the default values.

matthewhanson commented 9 years ago

Can you verify the version used here? Based on the error message, and the error about Basename, I think this must be v1.0.0. This has already been fixed with the latest, which I just tagged to be 1.1.0b1