Select to view content in your preferred language

Reproject Las Dataset using arcpy in VisualCode

152
4
Wednesday
CarlaNardinocchi
Occasional Contributor

Hi, I am starting to build a project in Visual Code using the ArcPy library.

I need to convert a LAS file defined in a geographic coordinate system (6706) into a projected file (same ellipsoid, 7794-UTM Italy zone).

Everything works in ArcGIS Pro using ExtractLas, but the Python function (https://pro.arcgis.com/en/pro-app/latest/tool-reference/3d-analyst/extract-las.htm) has no parameters for reprojecting the coordinate system.

I have tried using ProjectLas (https://pro.arcgis.com/en/pro-app/latest/tool-reference/data-management/project-las.htm), which should be in arcpy.management, but I received an AttributeError stating that the module 'arcpy.management' has no attribute 'ProjectLas'.

Can you please tell me how I can perform this reprojection in a Visual Code Python script?

Thank you very much for any help!

0 Kudos
4 Replies
DanPatterson
MVP Esteemed Contributor

Project las is new to arcgis pro 3.5

Project LAS (Data Management)—ArcGIS Pro | Documentation

you will see there is only 3.5 as the selectable version


... sort of retired...
CarlaNardinocchi
Occasional Contributor

Thanks for the information, I will not spend more time on  ProjectLas, but what can I use in the Visual Code  python script to reproject my las dataset?

 

0 Kudos
jrolson14
New Contributor

I've used LAStools in a mostly ArcPy script before to work with lidar. If you create a command line string including the path of the specific tool and the parameters, the script can then run it using os.system().

CarlaNardinocchi
Occasional Contributor

Thank you for your help!

I would like to share the solution I found with you and anyone who may have the same problem.

@jrolson14 I don't like using LasTools because I only have the free toolbox, which has some limitations. I prefer to avoid it, especially for coordinate projection, which is GIS-related.

I updated to ArcGIS Pro 3.5, and, as suggested by @DanPatterson , I stopped working with ProjectLas(). However, I decided to continue working with ExtractLas() because it was the function I was using in ArcGIS Pro.

I learned that I had to set the projection in the environment. Using the following code

# Output coordinate system (EPSG:7794)
output_coordinate_system = arcpy.SpatialReference(7794)

# Set the environment 
arcpy.env.outputCoordinateSystem = output_coordinate_system

# Use the Extract LAS tool to project the LAS dataset

arcpy.ddd.ExtractLas(input_las,output_folder,name_suffix='_7794')

 

And I was able to project the LAS dataset from epsg:6706 (geographic coordinates) to epsg:7794 (projected coordinates with the same datum and ellipsoid).

0 Kudos