Problem. I have 413 ASCII files totalling 4 billion points, and my system cannot handle converting them to MULTIPOINT so that I can generate Terrains. Therefore I would like to create 12+ subsets of the area, using the lists generated from a shapefile(s).
I've made my seperate Feature Classes listing the variable number of files that will make up each subset.
I can generate (and print) a list of files from the Feature Class using the SearchCursor function.
I'm running into problems using the generated list(s) to actually create the MULTIPOINT Feature Classes.
Here is my code:
# Import modules
import arcpy, os, sys, traceback
from arcpy import env
# generate a list of ascii files from the area-subset feature classes
env.workspace=r"F:\RTAMS\Petawawa\11-Library\LEGEO_Aug2012\LEGEO_Aug2012.gdb\LiDAR_ASCII"
fc=arcpy.ListFeatureClasses()
for fc in fc:
cur=arcpy.SearchCursor (fc)
for row in cur:
fileName=row.TILENAME
#this is the location of the ASCII files we want to import, so we change the workspace
env.workspace=r"F:\RTAMS\Petawawa\11-Library\LEGEO_Aug2012\LiDAR\UTM18_WGS84\ASCII\FEATURES"
# we should now have a list of files, which we will use to import into area-subset MULTIPOINT files
# we set up some parameters for the ASCII3D to Feature Class tool
try:
arcpy.CheckOutExtension("3D")
outWorkspace=r"F:\RTAMS\Petawawa\11-Library\LEGEO_Aug2012\LEGEO_Aug2012.gdb\LiDAR_ASCII_to_MULTIPOINT"
inFormat="GENERATE"
outFC=os.path.join(outWorkspace,fc+"_a")
outType="MULTIPOINT"
# find the ascii files listed in the search cursor
txtList=arcpy.ListFiles(fileName)
#Execute the ASCII3D_to_Feature_Class
arcpy.ASCII3DToFeatureClass_3d(txtList,inFormat,outFC,outType)
print outFC + " is complete."
except arcpy.ExecuteError:
print arcpy.GetMessages()
except:
# Get the traceback object
tb = sys.exc_info()[2]
tbinfo = traceback.format_tb(tb)[0]
# Concatenate error information into message string
pymsg = 'PYTHON ERRORS:\nTraceback info:\n{0}\nError Info:\n{1}'\
.format(tbinfo, str(sys.exc_info()[1]))
msgs = 'ArcPy ERRORS:\n {0}\n'.format(arcpy.GetMessages(2))
# Return python error messages for script tool or Python Window
arcpy.AddError(pymsg)
arcpy.AddError(msgs)
Hoping you can help me out.
No comments:
Post a Comment