2

In order to extract points from a .lasd (here, I call it "x.lasd") by 30 individual polygons, I am using the following code for the Extract LAS tool in ArcGIS 10.4:

inCuadriculas = r'C:\Users\...\cuadriculas' #This folder contaings 30 polygons
inLas = r'C:\Users\...\x.lasd' #This is the las dataset that contains 4 las files
outLas = r'C:\Users\...\outLas' #This folder will contain all the 33 .lasd outputs

for las in inCuadriculas: #loop in the folder
    j=2 # variable to rename the future .lasd outputs
    arcpy.ExtractLas_3d(inLas,outLas,"",inCuadriculas,"PROCESS_EXTENT","","MAINTAIN_VLR","REARRANGE_POINTS","NO_COMPUTE_STATS",os.path.join(outLas,"las{0}".format(j)))
    print inCuadriculas # Check the name of the polygons. 

I get this error:

Message File Name Line Position Traceback
C:\Users...\clip_las.py 49
ExtractLas c:\program files (x86)\arcgis\desktop10.4\ArcPy\arcpy\ddd.py 2003 ExecuteError: Failed to execute. Parameters are not valid. ERROR 000732: Extraction Boundary: Dataset C:\Users...\cuadriculas does not exist or is not supported Failed to execute (ExtractLas).

According to the tool guide in: http://desktop.arcgis.com/en/arcmap/latest/tools/3d-analyst-toolbox/extract-las.htm, the third parameter (extent) is optional.

  • The tool name is ExtractLas, but in the code you use ExtractLas_3d. Why is that? – Andre Silva Mar 28 '17 at 19:56
  • 1
    You are right, Andre Silva. In the link I show, there is the ExtractLas_3d and ExtractLas nomenclature... I used ExtractLas_3d and I have the result expected. – Ric_02 Mar 30 '17 at 15:15
2

Do you want to run ExtractLas_3d for each of the 30 polygons?

You cant "loop a folder" with for las in inCuadriculas since inCuadriculas is a path (string) to a folder. You need to list the polygons with ListFeatureClasses and then loop over each of the listed polygons:

import arcpy
inCuadriculas = r'C:\Users\...\cuadriculas'
inLas = r'C:\Users\...\x.lasd'
outLas = r'C:\Users\...\outLas'

arcpy.env.workspace=inCuadriculas

polylist=arcpy.ListFeatureClasses(feature_type='Polygon')

for polygon in polylist:
    arcpy.ExtractLas_3d(in_las_dataset=inLas, target_folder=outLas, boundary=polygon, 
                        process_entire_files='PROCESS_EXTENT', remove_vlr='MAINTAIN_VLR',
                        rearrange_points='REARRANGE_POINTS', compute_stats='NO_COMPUTE_STATS', 
                        out_las_dataset='Outlas_{0}'.format(polygon))
  • 1. The first question is because there is another tool? 2. I am adding 'Outlas_{0}.lasd'.format(polygon)) in order to have a las dataset as a result, but it doesn't work. I tried it manually, and it creates the las dataset. – Ric_02 Mar 22 '17 at 14:28

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.