1

I am trying to write a code that creates a Terrain from lidar data (LAS). The problem is that the inputs are in Feature Dataset in GDB but I don't know how to write code so that using an interface. I won't write the whole code just the part that it's not working. Las data is saved in the new Feature Dataset created in the same script. I need to somehow replace D:\Google Drive\GDB2.gdb\data2\las with just las. I tried everything - by removing '' and it doesn't work. The error that I always get is: executing tool - Failed to execute (GDB). Can anyone help me? I wrote the parts of the code that are significant for creating terrain, the last line doesn't work:

import arcpy
GDB_Location = arcpy.GetParameterAsText(0)
GDB_name = arcpy.GetParameterAsText(1)
GDB_file = arcpy.CreateFileGDB_management(GDB_Location, GDB_name) 
out_dataset_path = GDB_file
out_dataset_name = arcpy.GetParameterAsText(2)
feature_dataset = arcpy.CreateFeatureDataset_management(out_dataset_path,out_dataset_name)

arcpy.DefineProjection_management(feature_dataset, "PROJCS['WGS_1984_World_Mercator',GEOGCS['GCS_WGS_1984',DATUM['D_WGS_1984',SPHEROID['WGS_1984',6378137.0,298.257223563]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]],PROJECTION['Mercator'],PARAMETER['False_Easting',0.0],PARAMETER['False_Northing',0.0],PARAMETER['Central_Meridian',0.0],PARAMETER['Standard_Parallel_1',0.0],UNIT['Meter',1.0]]")

....

l_g = 'las'
las_data = '{0}\{1}'.format(feature_dataset,l_g)
arcpy.LASToMultipoint_3d #in this step in created las

fd = feature_dataset
terrain = 'terrain'
terrain2 = '{0}\{1}'.format(feature_dataset,terrain)

    # Process: Create Terrain
arcpy.CreateTerrain_3d(fd,lidar_terrain, Average_Point_Spacing, "50000", "", "WINDOWSIZE", "ZMIN", "NONE", "1")

# Process: Add Terrain Pyramid Level
arcpy.AddTerrainPyramidLevel_3d(terrain2, "", "'1 5000'")

# Process: Add Feature Class to Terrain
arcpy.AddFeatureClassToTerrain_3d(terrain2, "'D:\Google Drive\GDB2.gdb\data2\las' Shape Mass_Points 1 0 1 true false las_ground_embed <None> false")
2

Try removing single quotes around the full path and use forward slashes. Like:

# Process: Add Feature Class to Terrain
arcpy.AddFeatureClassToTerrain_3d(terrain2, "D:/Google Drive/GDB2.gdb/data2/las Shape Mass_Points 1 0 1 true false las_ground_embed <None> false")

Example:

arcpy.CheckOutExtension("3D")
env.workspace = "C:/data"
params = "terrain.gdb/terrainFDS/points2 SHAPE masspoints 2 0 10 true false "\
   "points_embed <None> false"
arcpy.AddFeatureClassToTerrain_3d("test.gdb/featuredataset/terrain", params)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.