Select to view content in your preferred language

LAS to Raster conversion

6968
14
03-25-2014 06:04 AM
PhilipMuggeridge
Emerging Contributor
Hi,

I'm having a problem setting the interpolation type in the arcpy.LasDatasetToRaster_conversion python code...I wish to use:

Triangulation, LINEAR, NO_THINNING as the options...

however there appears to be no choice when hovering over interpolation type in the python window and I receive the runtime error "Cannot set input into parameter interpolation_type when using 'TRIANGULATION LINEAR WINDOW_SIZE 10' as described in the ArcGIS 10.1 help guide: http://resources.arcgis.com/en/help/main/10.1/index.html#//001200000052000000

The guide talks about arcpy.LasDatasetToRaster_3d in the python window (this doesn't appear to exist...I have checkout out 3D analyst) and arcpy.conversion.LasDatasetToRaster for the standalone python script brings the same runtime error...

Is this a known ESRI bug or am I doing something wrong??? Any help would be much appreciated,

Thanks

Phil
Tags (2)
0 Kudos
14 Replies
JoshuaChisholm
Frequent Contributor
Hello Phil,

Could you please post the exact line you are inputting into the python window (and stand alone script)?

I think you might be inputting the parameters in the wrong way (this tool has an abnormal way of taking inputs).
Would this work?
arcpy.LasDatasetToRaster_3d(inputLASFile, outputRasterFile, 'ELEVATION', 'TRIANGULATION LINEAR NONE')
0 Kudos
PhilipMuggeridge
Emerging Contributor
Hi,

Thanks for the speedy reply,

In the python window I've just used your comments and set up the following

import arcpy
from arcpy import env
env.workspace = "CURRENT"
arcpy.CheckOutExtension('3D')
inputLASFile = "LAS.lasd"
outputRasterFile = "Raster"
arcpy.LasDatasetToRaster_3d(inputLASFile, outputRasterFile, 'ELEVATION', 'TRIANGULATION LINEAR NONE')

I receive the same error AttributeError: 'module' object has no attribute 'LasDatasetToRaster_3d' as previous

I'm running Standard (ArcEditor) license with 3D analyst switched on
0 Kudos
JoshuaChisholm
Frequent Contributor
Hello Phil,

I'm confused too...
Try out: arcpy.LasDatasetToRaster_conversion instead of arcpy.LasDatasetToRaster_3d.

Please let me know if that works.
0 Kudos
PhilipMuggeridge
Emerging Contributor
Hi,

yep so when changing to:

import arcpy
from arcpy import env
env.workspace = "CURRENT"
arcpy.CheckInExtension('3D')
inputLASFile = "LAS.lasd"
outputRasterFile = "Raster"
arcpy.LasDatasetToRaster_conversion(inputLASFile, outputRasterFile, 'ELEVATION', 'TRIANGULATION LINEAR NONE')

I get the error msg:

Runtime error  Traceback (most recent call last):   File "<string>", line 7, in <module>   File "c:\program files (x86)\arcgis\desktop10.1\arcpy\arcpy\conversion.py", line 2329, in LasDatasetToRaster     raise e ExecuteError: ERROR 000622: Failed to execute (LAS Dataset to Raster). Parameters are not valid. ERROR 000628: Cannot set input into parameter interpolation_type. 

I had been using "" instead of  'TRIANGULATION LINEAR NONE' however this is causing an issue in generating a 1m raster where the point spacing and z difference between nearest point in the LAS dataset on undulating ground (coastal areas in particular) causes 'striping' artefacts. Using triangulation will remove this problem and works through the ArcToolbox Las to Raster conversion manual method

Thanks

Phil
0 Kudos
JoshuaChisholm
Frequent Contributor
I ran the tool manually (with desired settings) and it worked. Then I went to Geoprocessing > Results right-clicked on the tool that just finished running and selected "Copy as Python Snippet". I pasted the code into both the python window and a stand alone script. It worked in both cases.
This is the code that is working for me:
arcpy.LasDatasetToRaster_conversion(inputLASFile,outputRasterFile,"ELEVATION","#","FLOAT","CELLSIZE","10","1")

Let me know if it works for you too Phil!
0 Kudos
PhilipMuggeridge
Emerging Contributor
Hi,

so I ran it back through using the code: arcpy.LasDatasetToRaster_conversion(inputLASFile,outputRasterFile,"ELEVATION","#","FLOAT","CELLSIZE","1","1")

It outputs a raster however I don't believe it uses the triangulation method I require as comparing results from the python window run with that of the manual method in ArcToolBox (with Triangulation, LINEAR set) the z values on slopes are >10cm different in places from cell to cell....once a hillshade is generated they look very different....we have a previous process in ArcView3.3 that we are trying to re-create and update for Arc10 and it's this output I'm comparing against.

so the issue appears to be why "#" isn't being read as 'triangulation' and I'm currently stumped as to how to input this through python?

Thanks for all your help so far, hopefully we can solve this somehow 🙂

Phil
0 Kudos
JoshuaChisholm
Frequent Contributor
Good catch Phil.

The rasters are different on my machine too. I've tried poking around in the source code a bit, but with no success. I'm thinking this might be an ESRI issue (as you originally mentioned), perhaps a bug, or at the least a need for improved documentation. So far I've had the following issues:

  • In the documentation the function is called LasDatasetToRaster_conversion, but the Code Samples use LasDatasetToRaster_3d and LasDatasetToRaster.

  • The Code Sample (Example 1) doesn't work (or at least not for me).

  • The Parameter interpolation_type does not seem to work as indicated.

  • The results from the python code snippet does not produce the same results at the tool it was copied from.

0 Kudos
PhilipMuggeridge
Emerging Contributor
Hi

Yes I agree I'm seeing those issues, I built the tool in model builder then exported as a python script and had the same issue as the python code snippet. I think It's probably worth forwarding to ESRI for further investigation as we may have come to a dead end? Thanks for all your help, if you have any further thoughts please let me know

Phil
0 Kudos
JakeSkinner
Esri Esteemed Contributor
You may be encountering the following bug, NIM092807.
0 Kudos