Recently we attempted to do a small LiDAR survey by drone for a pet project of our CEO in our “code and surf camp” here in Samara, Costa Rica. But surveying is difficult when you are a novice and we ran into a trajectory issue. The dramatic “wobbles” were entirely our fault, but fortunately our mistakes also led to something useful: We found some LAS export bugs. Our laser scanner was a Velodyne HDL-32E integrated with a NovAtel INS into the Snoopy Series A HD made by LiDARUSA. The system was carried by a DJI Matrice 600 (M600) drone. We processed the trajectory with NovAtel Inertial Explorer (here we made the “wobbles” error) and finally exported the LAS and LAZ files with ScanLook PC (version 1.0.182) from LiDARUSA.
While we were investigating our “wobbles” (which clearly were our mistake) we also found five different LAS export bugs in ScanLook PC that seem to have started sometime after version 1.0.171 and will likely end with version 1.0.193. Below an illustration of a correct export from version 1.0.129 and a buggy export from version 1.0.182. In both instances you see the returns from one revolution of the Velodyne HDL-32E scanner head ordered by their GPS time stamps and colored to distinguish the 32 separate beams. In the buggy version, groups of around seven non-adjacent returns are given the same time stamp. This bug will only affect you, if correct GPS time stamps are important for your subsequent LiDAR processing or if your client explicitly asked for ASPRS specification compliant LAS files. We plan to publish another blog post detailing how to find this GPS time stamping bug (and the other four bugs we found).
During the many interactions we had working through “wobbles” and export bugs, we obtained a nice set of six flight lines from Seth Gulich of Bowman Consulting – a US American company based in Stuart, Florida – who flew an identical “Snoopy Series A HD” system also on a DJI Matrice 600 drone at approximately 100 feet above ground level above a model airplane airport in Palm Beach, Florida. You can download the data set here. In the following we will check the flight line alignment of this data set and then process it into a smooth DTM. All command lines used are summarized in this text file.
First we generate a lasinfo report that includes a number of histograms for on-the-fly merged flight lines with lasinfo and then use the z coordinate histogram from the lasinfo report to set reasonable min/max values for the elevation color ramp of lasview:
lasinfo -i 0_strips_raw\Velodyne*.laz -merged ^ -cd ^ -histo z 1 ^ -histo user_data 1 ^ -histo point_source 1 ^ -o 1_quality\Velodyne_merged_info.txt lasview -i 0_strips_raw\Velodyne*.laz ^ -points 10000000 ^ -set_min_max 25 75
The lasinfo report shows no information about the coordinate reference system. We found out experimentally that the horizontal coordinates seem to be EPSG code 2236 and that the vertical units are most likely be US survey feet. The warnings you will see in the lasinfo report have to do with the fact that the double-precision bounding box stored in the LAS header was populated with numbers that have many more decimal digits than the coordinates in the file, which only have millifeet resolution as all three scale factors are 0.001 (meaning coordinates have three decimal digits). The information which of the 32 lasers was collecting which point is stored in both the ‘user data’ and the ‘point source ID’ field which is evident from the histograms in the lasinfo report. We need to be careful not to override both fields in later processing.
Next we use lasoverlap to check how well the LiDAR points from the flight out and the flight back align vertically. This tool computes the difference of the lowest points for each square foot covered by multiple flight lines. Differences of less than a quarter of a foot are both times mapped to white, differences of more than one foot (more than half a foot) are mapped to saturated red or blue depending on whether the difference is positive or negative in the first run (in the second run):
lasoverlap -i 0_strips_raw\Velodyne*.laz ^ -faf ^ -min_diff 0.25 -max_diff 1.00 -step 1 ^ -odir 1_quality -o overlap_025_100.png lasoverlap -i 0_strips_raw\Velodyne*.laz ^ -faf ^ -min_diff 0.25 -max_diff 0.50 -step 1 ^ -odir 1_quality -o overlap_025_050.png
We use a new feature of the LAStools GUI (as of version 180429) to closer inspect large red or blue areas. With lasmerge we clip out regions that looks suspect for closer examination with lasview. First we spatially index the flight lines to make this process faster. With the ‘-gui’ switch we start the tool in GUI mode with flight lines already loaded. Using the new PNG overlay roll-out on the left we add the ‘overlap_025_050_diff.png’ image from the quality folder created in the last step and clip out three areas.
lasindex -i 0_strips_raw\Velodyne*.laz -tile_size 10 -maximum -100 ^ -cores 3 lasmerge -i 0_strips_raw\Velodyne*.laz -gui
You can also clip out these three areas using the command lines below:
lasmerge -i 0_strips_raw\Velodyne*.laz ^ -faf ^ -inside_tile 939500 889860 100 ^ -o 1_quality\939500_889860.laz lasmerge -i 0_strips_raw\Velodyne*.laz ^ -faf ^ -inside_tile 940400 889620 100 ^ -o 1_quality\940400_889620.laz lasmerge -i 0_strips_raw\Velodyne*.laz ^ -faf ^ -inside_tile 940500 890180 100 ^ -o 1_quality\940500_890180.laz
The reader may inspect the areas 939500_889860.laz, 940400_889620.laz, and 940500_890180.laz with lasview using profile views via hot keys ‘x’ and switching back and forth between the points from different flight lines via hot keys ‘0’, ‘1’, ‘2’, ‘3’, … for individual and ‘a’ for all flight lines as we have done it in previous tutorials [1,2,3]. Using drop-lines or rise-lines via the pop-up menu gives you a sense of scale. Removing points with lastrack that are horizontally too far from the trajectory could be one strategy to use fewer outliers. But as our surfaces are expected to be “fluffy” (because we have a Velodyne LiDAR system), we accept these flight line differences and continue processing.
Here the complete LAStools processing pipeline for creating an average ground model from the set of six flight lines that results in the hillshaded DTM shown below. The workflow is similar to those we have developed in earlier blog posts for Velodyne Puck based systems like the Hovermap and the Yellowscan and in the other Snoopy tutorial. All command lines used are summarized in this text file.
In the first step we lastile the six flight lines into 250 by 250 feet tiles with 25 feet buffer while preserving flight line information. The flight line information will be stored in the “point source ID” field of each point and therefore override the beam ID that is currently stored there. But the beam ID is also stored in the “user data” field as the lasinfo report had told us. We set all classifications to zero and add information about the horizontal coordinate reference system EPSG code 2236 and the vertical units (US Survey Feet).
lastile -i 0_strips_raw\*.laz ^ -faf ^ -set_classification 0 ^ -epsg 2236 -elevation_survey_feet ^ -tile_size 250 -buffer 25 -flag_as_withheld ^ -odir 2_tiles_raw -o pb.laz
On three cores in parallel we then lassort the points in the tiles into a space-filling curve order which will accelerate later operations.
lassort -i 2_tiles_raw\*.laz ^ -odir 2_tiles_sorted -olaz ^ -cores 3
Next we use lasthin to classify the point whose elevation is closest to the 5th elevation percentile among all points falling into its cell with classification code 8. We run lasthin multiple times and each time increase the cell size from 1, 2, 4, 8 to 16 foot. We do this because we have requested the 5th elevation percentile to only be computed when there are at least 20 points in the cell. Percentiles are statistical measures and need a reasonable sample size to be stable. Because drone flights are very dense in the center and more sparse at the edges this increase in cell size assures that we have a good selection of points classified with classification code 8 across the entire survey area.
lasthin -i 2_tiles_sorted\*.laz ^ -step 1 -percentile 5 20 -classify_as 8 ^ -odir 3_tiles_thinned_p05_step01 -olaz ^ -cores 3 lasthin -i 3_tiles_thinned_p05_step01\*.laz ^ -step 2 -percentile 5 20 -classify_as 8 ^ -odir 3_tiles_thinned_p05_step02 -olaz ^ -cores 3 lasthin -i 3_tiles_thinned_p05_step02\*.laz ^ -step 4 -percentile 5 20 -classify_as 8 ^ -odir 3_tiles_thinned_p05_step04 -olaz ^ -cores 3 lasthin -i 3_tiles_thinned_p05_step04\*.laz ^ -step 8 -percentile 5 20 -classify_as 8 ^ -odir 3_tiles_thinned_p05_step08 -olaz ^ -cores 3 lasthin -i 3_tiles_thinned_p05_step08\*.laz ^ -step 16 -percentile 5 20 -classify_as 8 ^ -odir 3_tiles_thinned_p05_step16 -olaz ^ -cores 3
Then we let lasground_new run on only the points classified with classification code 8 (i.e. by ignoring the points still classified with code 0) which classifies them into ground (code 2) and non-ground (code 1).
lasground_new -i 3_tiles_thinned_p05_step16\*.laz ^ -ignore_class 0 ^ -town ^ -odir 4_tiles_ground_low -olaz ^ -cores 3
The ground points we have computed form somewhat of a lower envelope of the “fluffy” points of a Velodyne scanner. With lasheight we now draw all the points near the ground – namely those from 0.1 foot below to 0.4 foot above the ground – into a new classification code 6 that we term “thick ground”. The ‘-do_not_store_in_user_data’ switch prevent the default behavior of lasheight from happening, which would override the beam ID information that it stored in the ‘user data’ field with approximate height value.
lasheight -i 4_tiles_ground_low\*.laz ^ -classify_between -0.1 0.4 6 ^ -do_not_store_in_user_data ^ -odir 4_tiles_ground_thick -olaz ^ -cores 3
A few close-up shots of the resulting “thick ground” are shown in the picture gallery below.
We then use lasgrid to average the (orange) thick ground points onto a regular grid with a cell spacing of half a foot. We do not grid the tile buffers by adding the ‘-use_tile_bb’ switch.
lasgrid -i 4_tiles_ground_thick\*.laz ^ -keep_class 6 ^ -step 0.5 -average ^ -use_tile_bb ^ -odir 5_tiles_gridded_mean_ground -olaz ^ -cores 3
Finally we use blast2dem to merge all the averaged ground point grids into one file, interpolate across open areas without ground points, and compute the hillshaded DTM shown above. All command lines used are summarized in this text file.
blast2dem -i 5_tiles_gridded_mean_ground\*.laz ^ -merged ^ -step 0.5 ^ -hillshade ^ -o dtm.png
We thank Seth Gulich of Bowman Consulting for sharing this LiDAR data set with us. It was flown with a DJI Matrice 600 drone carrying a “Snoopy A series HD” LiDAR system from LidarUSA.
Pingback: Generating DTM for fluffy Livox MID-40 LiDAR via “median ground” points | rapidlasso GmbH