Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I'm writing a script to convert lidar data (in .las format) into a terrain without going through all the clicking and so I can send it out to neighboring states with similar programs (I'm using ArcGIS 10.1 btw). I've gotten almost there with the script but issues arise when I try adding the Multipoint to the Terrain in the Feature Dataset. I've done this step in model builder and exported that to a python script and am using the "in_features" that's output from the model. Incidentally, the model runs just fine in arcmap, but when I try to run the exported python script I get errors.

import os
import arcpy, math, glob
from arcpy import env

arcpy.CheckOutExtension("3D")
arcpy.env.overwriteOutput = True
#make workspace in memory
arcpy.env.workspace = "in_memory"

#create a feature dataset for export
#change geodatabase to a getparameter
geodatabase = r'C:\Users\peter.a.metzger\Desktop\Projects\LiDAR\test_data\lidar_test.gdb'
outgeodatabase = 'test_lidar_output'
projection = r'C:\Users\peter.a.metzger\AppData\Roaming\ESRI\Desktop10.1\ArcMap\Coordinate Systems\NAD83_UTM_zone_14N.prj'
created_FC_tool = arcpy.CreateFeatureDataset_management(geodatabase, outgeodatabase, projection)
created_FC = created_FC_tool.getOutput(0)
#Create a Terrain

terrain_name = 'test_Terrain' #Change to a getparameter
arcpy.CreateTerrain_3d (created_FC, terrain_name, 1.24605815948, 50000, '', 'WINDOWSIZE', 'ZMIN', 'NONE', 1)

output_terrain = os.path.join (created_FC, terrain_name)
arcpy.AddTerrainPyramidLevel_3d (output_terrain, 'WINDOWSIZE', '2.5 1000; 5 2000; 10 4000; 20 8000; 40 16000')
#process the .las file and add to the feature dataset and terrain

os.chdir (r'C:\Users\peter.a.metzger\Desktop\Projects\lidar_model_test_data\R06305328')
for LASfiles in glob.glob("*.las"):
    print LASfiles
    pointinfo = "point_file_information"
    #Get Pointfile information
    arcpy.PointFileInformation_3d(LASfiles, pointinfo, "LAS", "", projection)

    #get average point spacing variable
    pointspacing = arcpy.SearchCursor (pointinfo)
    field = "Pt_Spacing"
    for row in pointspacing:
        avg_space = (row.getValue(field))
    print avg_space

    #convert las  to multipoint

    #create lable for multipoint file
    listlable = list(LASfiles)
    del listlable[-4]
    multipointlable = ''.join(listlable)
    print multipointlable

    print created_FC
    outputPlable = os.path.join (created_FC, multipointlable)
    #class_code, change to a getparameter
    class_code = 2

    print outputPlable

    outputPlable_parameters = outputPlable + ' Shape Mass_Points 1 0 40 true false R06305328las_embed <None> false'
    print outputPlable_parameters
    arcpy.AddFeatureClassToTerrain_3d (output_terrain, outputPlable_parameters)

The error I'm getting is:

"Traceback (most recent call last): File "C:\Users\peter.a.metzger\Desktop\Projects\LiDAR\las2terrain.py", line 64, in arcpy.AddFeatureClassToTerrain_3d (output_terrain, outputPlable_parameters) File "C:\Program Files (x86)\ArcGIS\Desktop10.1\arcpy\arcpy\ddd.py", line 1843, in AddFeatureClassToTerrain raise e ExecuteError: Failed to execute. Parameters are not valid. ERROR 000800: The value is not a member of . Failed to execute (AddFeatureClassToTerrain)."

And it's from the parameter that I set of: "outputPlable_parameters = outputPlable + ' Shape Mass_Points 1 0 40 true false R06305328las_embed false'"

These values are what the model builder is using, yet it's not working.

share|improve this question
    
What are you getting for output when you print outputPLable_parameters? I think the keyword Mass_Points may need to be changed to masspoints in the third to last line –  blord-castillo Mar 21 '13 at 19:35
    
Have to do it in ArcGIS, my organization locks down our machines and most software isn't authorized. But converting it to ascii would leave me with a feature class that would still need to be added to a terrain. –  Pete Mar 22 '13 at 13:30
    
outputPlable_parameters returns "C:\Users\xxxxxx\Desktop\Projects\LiDAR\test_data\lidar_test.gdb\test_lidar_outp‌​ut\R06305328las Shape Mass_Points 1 0 40 true false R06305328las_embed <None> false" I changed "Mass_Points" to masspoints and I got the same return. I think it has something to do with that "<None>". –  Pete Mar 22 '13 at 13:33
    
Did you copy paste that line? There are two hidden characters between the p and u in input (which happen to fall right at column 80, which makes me suspect they are just carriage return and new line from your output, but hopefully not part of the path). –  blord-castillo Mar 22 '13 at 14:06
1  
Everyone, I feel really stupid. The reason it wasn't working is I left out the arcpy.LASToMultipoint_3d... Doh! –  Pete Mar 25 '13 at 19:21
show 2 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.