AnsweredAssumed Answered

Cannot add lasd to map using python script in 10.2.2

Question asked by mnigrell on Nov 13, 2014

I created a python script which creates a las dataset and adds it to the map. It worked fine in 10.1. I just installed 10.2.2 and now it gives me an error when I run the script. Is there something wrong with my script or did something change between 10.1 and 10.2.2 in terms of programmatically adding a lasd layer to a map?

 

Here's the offending subset of my script:

        arcpy.management.CreateLasDataset(InputLAS, OutputLASD, "NO_RECURSION", "", "", "", "RELATIVE_PATHS")

        Output_LASD_Layer = arcpy.CreateUniqueName("OutputLASD.lasd")

        arcpy.management.MakeLasDatasetLayer(OutputLASD, Output_LASD_Layer)

        addlayer = arcpy.mapping.Layer(Output_LASD_Layer)

        addlayer.name = Output_LASD_Layer_String

        arcpy.mapping.AddLayer(DataFrame, addlayer)

 

I get a value error:

Traceback (most recent call last):

  File "Script.py", line 138, in <module>

    addlayer = arcpy.mapping.Layer(Output_LASD_Layer)

  File "c:\program files (x86)\arcgis\desktop10.2\arcpy\arcpy\arcobjects\mixins.py", line 389, in __init__

    super(LayerMixin, self).__init__(lyrfile)

  File "c:\program files (x86)\arcgis\desktop10.2\arcpy\arcpy\arcobjects\_base.py", line 47, in __init__

    for arg in args))

ValueError: Object: CreateObject Layer invalid data source

Outcomes