<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Creating LAS Datasets from .LAS files then convert each individual .las file to a in Transportation Questions</title>
    <link>https://community.esri.com/t5/transportation-questions/creating-las-datasets-from-las-files-then-convert/m-p/466134#M1604</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You can iterate through the las files and convert to tin:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
import os
import arcpy
import glob

# this is a folder containing .las files
ws = r'C:\some_path\to_your\las_files'&amp;nbsp; 

# get list of .las files
inLas = glob.glob(os.path.join(ws, '*.las'))
print 'found {0} .las files'.format(len(inLas))
print inLas

# directories
lasd_dir = r'C:\some_path\for_lasd_files'
tin_dir = os.path.join(lasd_dir, 'tins')
if not os.path.exists(tin_dir):
&amp;nbsp;&amp;nbsp;&amp;nbsp; os.makedirs(tin_dir)

# iterate through .las files
for las in inLas:
&amp;nbsp;&amp;nbsp;&amp;nbsp; lasD = os.path.join(lasd_dir, os.path.basename(las) + 'd')
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.management.CreateLasDataset(inLas,lasD)
&amp;nbsp;&amp;nbsp;&amp;nbsp; print 'Created Las dataset: {0}'.format(lasD)
&amp;nbsp;&amp;nbsp;&amp;nbsp; out_tin = os.path.join(tin_dir, os.path.basename(las).split('.')[0][:9] + '_tin')
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.LasDatasetToTin_3d(lasD, out_tin)
&amp;nbsp;&amp;nbsp;&amp;nbsp; print 'Created tin: {0}'.format(out_tin)

print 'Process complete.'&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 20:40:46 GMT</pubDate>
    <dc:creator>Anonymous User</dc:creator>
    <dc:date>2021-12-11T20:40:46Z</dc:date>
    <item>
      <title>Creating LAS Datasets from .LAS files then convert each individual .las file to a tin</title>
      <link>https://community.esri.com/t5/transportation-questions/creating-las-datasets-from-las-files-then-convert/m-p/466131#M1601</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Original User: MF79386&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Folks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am a SUPER new python user and I am attempting to do the following:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;1. Navigate to a folder full of .las files&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2. Use the data management tool "create las dataset" to create an las dataset for each individual .las file&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;3. Convert said .lasd file into a tin using 3d Analyst's "LAS Dataset to TIN" tool&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;4. Repeat this process for ~100 or so .las files, ultimately ending up w/ 100 individual .adf files&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I can perform this fairly easily using modelbuilder and batch mode, but it's somewhat time consuming.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;My question: How in the world do I go about automating this process? I am attempting to write a script (command line using the powershell) to run everything outside of the GUI, but would be happy to even figure out how to do it w/in ArcPy if necessary. My initial attempts used some code from the ESRI help menu. What follows was my attempt to take 1 .las file, and convert it to a .lasd file (steps 1-2 above):&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;import os&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;import arcpy&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;import exceptions, sys, traceback&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;print "Set the input workspace for my .las files"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.env.workspace = raw_input()&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;print "This is my output workspace"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.env.workspace = raw_input()&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;try:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; print "Set local variables: inLas"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; inLas = raw_input()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; print "set local variables:outlas"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; lasD = raw_input()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; print "..and finally we will create the new LAS Dataset"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; arcpy.management.CreateLasDataset (inLas,lasD)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;except:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; print "Well you tried your best, better luck next time." &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Obviously I am lost in the sauce, and would love some guidance. I'm sure I'm forgetting to import something, or who knows what. TThanks!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Cheers,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Mike&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Jun 2014 20:40:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/transportation-questions/creating-las-datasets-from-las-files-then-convert/m-p/466131#M1601</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2014-06-17T20:40:16Z</dc:date>
    </item>
    <item>
      <title>Re: Creating LAS Datasets from .LAS files then convert each individual .las file to a</title>
      <link>https://community.esri.com/t5/transportation-questions/creating-las-datasets-from-las-files-then-convert/m-p/466132#M1602</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Is there a reason you want to use a command prompt style rather than a stand alone script?&amp;nbsp; Using a stand alone script will still be running completely outside of the GUI.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is an example on how you can do a command prompt style:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
import os
import arcpy
import glob

ws = raw_input("Set the input workspace for my .las files\n")
las_files = glob.glob(os.path.join(ws, '*.las'))

# create dictionary
las_dict = dict(enumerate(las_files))
las_dict[len(las_files)] = 'Include all .las files in this list'

# print menu
for num,las in sorted(las_dict.iteritems()):
&amp;nbsp;&amp;nbsp;&amp;nbsp; print '{0}: {1}'.format(num, las)

inLas = raw_input("\n\ncreate a comma separated list for all .las data sets " +
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "you want to include\nor choose {0} to select all .las files (ex&amp;nbsp; 1,2,3,7)\n".format(max(las_dict.keys())))

# choose full path for output .lasd file
lasD = raw_input('\nEnter full path to output .lasd file (ex. C:\Full_path\To_output\las_data.lasd)\n')

print "..and finally we will create the new LAS Dataset"
if ',' in inLas:
&amp;nbsp;&amp;nbsp;&amp;nbsp; inLas = map(lambda x: las_dict[int(x)], inLas.split(','))
else:
&amp;nbsp;&amp;nbsp;&amp;nbsp; if int(inLas) == len(las_files):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; inLas = las_files
&amp;nbsp;&amp;nbsp;&amp;nbsp; else:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; inLas = las_dict[int(inLas)]

arcpy.management.CreateLasDataset(inLas,lasD)
raw_input('Process complete...hit enter to close')
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Or how I would do it as a stand alone script:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
import os
import arcpy
import glob

# this is a folder containing .las files
ws = r'C:\some_path\to_your\las_files'&amp;nbsp; 

# get list of .las files
inLas = glob.glob(os.path.join(ws, '*.las'))
print 'found {0} .las files'.format(len(inLas))
print inLas

# name of output LAS data set
lasD = r'C:\full_path\to_output\las_data.lasd'

print "..and finally we will create the new LAS Dataset"
arcpy.management.CreateLasDataset(inLas,lasD) 
print 'Process complete.'
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 20:40:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/transportation-questions/creating-las-datasets-from-las-files-then-convert/m-p/466132#M1602</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-12-11T20:40:43Z</dc:date>
    </item>
    <item>
      <title>Re: Creating LAS Datasets from .LAS files then convert each individual .las file to a</title>
      <link>https://community.esri.com/t5/transportation-questions/creating-las-datasets-from-las-files-then-convert/m-p/466133#M1603</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Original User: MF79386&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Caleb,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks a lot for the feedback. I wrote that poorly, and was in fact trying to run it in a script, not necessarily from the command line.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm going to play w/ your code and try to find a way to parse out individual .las files as each needs to be in their own .lasd (and eventually their own TIN as well). So ultimately I will combine the lasd creation w/ the 3d analyst tool in an attempt to essentially batch all 150 or so .las files in a two-tool, two-step process. Appreciate the response!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Cheers,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Mike&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Jun 2014 14:24:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/transportation-questions/creating-las-datasets-from-las-files-then-convert/m-p/466133#M1603</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2014-06-18T14:24:04Z</dc:date>
    </item>
    <item>
      <title>Re: Creating LAS Datasets from .LAS files then convert each individual .las file to a</title>
      <link>https://community.esri.com/t5/transportation-questions/creating-las-datasets-from-las-files-then-convert/m-p/466134#M1604</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You can iterate through the las files and convert to tin:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
import os
import arcpy
import glob

# this is a folder containing .las files
ws = r'C:\some_path\to_your\las_files'&amp;nbsp; 

# get list of .las files
inLas = glob.glob(os.path.join(ws, '*.las'))
print 'found {0} .las files'.format(len(inLas))
print inLas

# directories
lasd_dir = r'C:\some_path\for_lasd_files'
tin_dir = os.path.join(lasd_dir, 'tins')
if not os.path.exists(tin_dir):
&amp;nbsp;&amp;nbsp;&amp;nbsp; os.makedirs(tin_dir)

# iterate through .las files
for las in inLas:
&amp;nbsp;&amp;nbsp;&amp;nbsp; lasD = os.path.join(lasd_dir, os.path.basename(las) + 'd')
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.management.CreateLasDataset(inLas,lasD)
&amp;nbsp;&amp;nbsp;&amp;nbsp; print 'Created Las dataset: {0}'.format(lasD)
&amp;nbsp;&amp;nbsp;&amp;nbsp; out_tin = os.path.join(tin_dir, os.path.basename(las).split('.')[0][:9] + '_tin')
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.LasDatasetToTin_3d(lasD, out_tin)
&amp;nbsp;&amp;nbsp;&amp;nbsp; print 'Created tin: {0}'.format(out_tin)

print 'Process complete.'&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 20:40:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/transportation-questions/creating-las-datasets-from-las-files-then-convert/m-p/466134#M1604</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-12-11T20:40:46Z</dc:date>
    </item>
  </channel>
</rss>

