Skip to content

Instantly share code, notes, and snippets.

@mpickering
Created September 29, 2017 08:32
Show Gist options
  • Save mpickering/89f488300f7068ba733bf02fa795503d to your computer and use it in GitHub Desktop.
Save mpickering/89f488300f7068ba733bf02fa795503d to your computer and use it in GitHub Desktop.
# /usr/bin/sh
# batch script for converting raw lidar data
# into a set of 250x250 m tiles suitable for contour and vegetation
# processing.
# Usage: lidar-batch <lidar_directory\*.laz> or <lidar_directory\*.las>
# Assumes all the lastools binaries and the perl files to be in the "c:\data\orientering" directory:
# if exist tiles_classified\tile*.laz goto tiles_generated
#: create buffered tiling
#mkdir tiles_raw
#wine /nix/store/g5i30f518q1371hwgrkvqvfyy88scl1j-laswindows/LAStools/bin/lastile.exe -i $1 -tile_size 250 -buffer 35 -o tiles_raw\tile -olaz -extra_pass
#echo Input LiDAR split into buffered tiles
# Add extra ground points, do vegetation height split and detect buildings
mkdir tiles_classified
# addground.pl -cores 7 -medium 4 tiles_raw\tile*.laz -odir tiles_classified -lasground 0
perl /nix/store/nx368y6q03jbc55pvypyzm9cnmrg7dq7-mapping/addground.pl -cores 7 -medium 4 input -odir tiles_classified
# addground.pl -cores 7 -medium 3 tiles_raw\tile*.laz -odir tiles_classified
# At this point we are ready to generate contour lines in DXF format for easy OCAD import
echo Classified tiles generated, ready to generate contours, slope/cliff/dem and vegetation
# pause
# Generate contours.dxf & contours.crt for ocad import. Picks output name from current directory
perl /nix/store/nx368y6q03jbc55pvypyzm9cnmrg7dq7-mapping/gen-dxf-iso-dep.pl -cores 7 -force -contour_intervals 25,5,1 tiles_classified/tile*.laz
# Generate Digital Elevation Model in .ASC format as well as slope and cliff images
# Merges the individual ASC tile files into a slope/cliff image and an ASC DEM
# gen-slope-asc_thin.pl -cores 7 -force tiles_classified\tile*.laz
perl /nix/store/nx368y6q03jbc55pvypyzm9cnmrg7dq7-mapping/gen-slope-asc-x.pl -cores 7 -force tiles_classified/tile*.laz -cliff 35
# Remove the temporary individual ASC files, one for each tile
# del /q tiles_classified\tile*.asc
# Generate vegetation model, uses the lasheight/lasclassify steps to determine vegetation points
perl /nix/store/nx368y6q03jbc55pvypyzm9cnmrg7dq7-mapping/gen-veg-multi-12bit.pl -cores 7 -force tiles_classified/tile*.laz
# Convert vegetation to vector data
perl /nix/store/nx368y6q03jbc55pvypyzm9cnmrg7dq7-mapping/veg2dxf.pl -cores 7 tiles_classified/tile*.gif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment