{"id":223,"date":"2018-12-21T11:07:20","date_gmt":"2018-12-21T10:07:20","guid":{"rendered":"https:\/\/sigeo.cerege.fr\/?p=223"},"modified":"2020-11-20T17:21:16","modified_gmt":"2020-11-20T16:21:16","slug":"workflow-for-generating-dem-from-lidar-into-arcgis","status":"publish","type":"post","link":"https:\/\/sigeo.cerege.fr\/?p=223","title":{"rendered":"Workflow for generating DEM from Lidar tiles"},"content":{"rendered":"\n<p>The original dataset comprises Lidar tiles with classified ground and with XYZ ASCII format of this type :<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">13.83535621 42.12214528 401.940 32 2\n13.83534713 42.12213870 401.870 28 2\n13.83533818 42.12213222 401.670 33 2\n13.83532879 42.12211645 401.950 30 1\n13.83533763 42.12212258 401.630 28 2\n13.83534682 42.12212933 401.830 29 2\n13.83535625 42.12213609 402.250 25 1<\/pre>\n\n\n<p>2 processing methods are proposes. The first is more straightforward, it uses bash only. The second uses ArcGIS.<\/p>\n<h2>Method 1 : with bash, GDAL, LAStools<\/h2>\n<p>All the input tiles are compressed in zip format.<\/p>\n<p>1- zip extraction :<\/p>\n<pre>for i in *.zip; do unzip $i -d .; done<\/pre>\n<p>The output is\u00a0 xyz files, with classification as last field. 1 for unclassified, 2 for ground (see example above)<\/p>\n<p>delete zip files with : <br \/>rm *.zip<\/p>\n<p>2-extract only ground points from xyz files<\/p>\n<pre>awk '{if ($5==2) print $0}' input &gt; output<\/pre>\n<p>for batch processing, see script &#8220;script_xyz2xyzground.sh&#8221;<\/p>\n<p>3-convert xyz format to las format<\/p>\n<pre>las2las -i input -o output<\/pre>\n<p>4-interpolation in grid with points2grid<\/p>\n<pre>for i in *.las; do BASE=`basename $i .las`;points2grid -i $i -o OUTPUT\/$BASE -r 0.00000707 --input_format las --output_format arc --mean --resolution 0.00001 --fill; done<\/pre>\n<p>5- convert asc format to tif<\/p>\n<pre>for i in *.asc; do BASE=`basename $i .asc`;gdal_translate -a_srs EPSG:4326 $i ${BASE}.tif;done<\/pre>\n<p>6- merge all tif tiles<\/p>\n<pre>gdal_merge.py -o MOSAIC\/Marche_lidar_full_mosaic_4326.tif -co COMPRESS=DEFLATE -co BIGTIFF=YES -co TILED=YES -a_nodata 0 *.tif<\/pre>\n<p>Optional step : fill holes<\/p>\n<pre>for i in *.tif; do BASE=`basename $i ..tif`;gdal_fillnodata.py $i ${BASE}_filled.tif -co compress=deflate -co bigtiff=yes -co tiled=yes;done<\/pre>\n<h2>Method 2 : with ArcGIS<\/h2>\n<p>Toolbox of several small scripts for processing Lidar point cloud and generating DTMs<\/p>\n<p>The original datasets are point clouds with ground already classified<\/p>\n<p>Steps :<\/p>\n<p>1 &#8211; extract only ground from the classified point cloud<br \/>This is done with awk. See description at this site https:\/\/sigeo.cerege.fr\/?p=199<\/p>\n<p>ex. of command for processing a file :<br \/>awk &#8216;{ if ( $5!=1 ) print $0 }&#8217; input.xyz &gt; output.xyz<br \/>to batch it in bash :<br \/>for i in *.xyz; do awk &#8216;{ if ( $5!=1 ) print $0 }&#8217; input.xyz &gt; output.xyz; done<\/p>\n<p>2- Convert ASCII XYZ file to LAS<br \/>This is done with ArcGis using the txt2las tool of LAStools, but it can also be done with libLAS or PDAL<br \/>The script in the ArcGIS toolbox is used in a batch mode<\/p>\n<p>3- Convert LAS files to LAS datasets<br \/>we created a small python script based on Arcpy that we use add to a Toolbox and use it in batch mode<br \/>see &#8220;convert_las2lasd.py&#8221;<\/p>\n<p>4- Convert Las datasets to TIN<br \/>we created a small python script based on Arcpy that we use add to a Toolbox and use it in batch mode<br \/>see &#8220;convert_lasd2tin.py&#8221;<\/p>\n<p>5- Convert Tin to raster<br \/>we created a small python script based on Arcpy that we use add to a Toolbox and use it in batch mode<br \/>see &#8220;convert_tin2raster.py&#8221;<\/p>\n<p>The scripts of steps 2 to 5 are used from a ArcGIS Toolbox<\/p>","protected":false},"excerpt":{"rendered":"<p>The original dataset comprises Lidar tiles with classified ground and with XYZ ASCII format of this type : 13.83535621 42.12214528 401.940 32 2 13.83534713 42.12213870 401.870 28 2 13.83533818 42.12213222 401.670 33 2 13.83532879 42.12211645 401.950 30 1 13.83533763 42.12212258 401.630 28 2 13.83534682 42.12212933 401.830 29 2 13.83535625 42.12213609 402.250 25 1 2 processing &hellip; <a href=\"https:\/\/sigeo.cerege.fr\/?p=223\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Workflow for generating DEM from Lidar tiles&#8221;<\/span><\/a><\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7,9],"tags":[],"class_list":["post-223","post","type-post","status-publish","format-standard","hentry","category-geo-traitements","category-lidar"],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/sigeo.cerege.fr\/index.php?rest_route=\/wp\/v2\/posts\/223","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sigeo.cerege.fr\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sigeo.cerege.fr\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sigeo.cerege.fr\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/sigeo.cerege.fr\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=223"}],"version-history":[{"count":6,"href":"https:\/\/sigeo.cerege.fr\/index.php?rest_route=\/wp\/v2\/posts\/223\/revisions"}],"predecessor-version":[{"id":559,"href":"https:\/\/sigeo.cerege.fr\/index.php?rest_route=\/wp\/v2\/posts\/223\/revisions\/559"}],"wp:attachment":[{"href":"https:\/\/sigeo.cerege.fr\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=223"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sigeo.cerege.fr\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=223"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sigeo.cerege.fr\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=223"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}