I am trying to create a GP Tool that I am trying to publish to Portal. It works in ArcGIS Pro but will not publish...
I put this code in the Script and when I double click the script in the toolbox it runs fine….Basically converting .laz files to .las files.
I then go to publish this GP Tool to my server and I get these two errors:
Why does this run via double clicking the script in the toolbox and fails when I try to publish this? Errors above…..
------- Parameters on the Script File in the Toolbox
------- ERROR:
------- CODE:
import arcpy
def ScriptTool(param0, param1, param2, param3):
# Script execution code goes here
LazFiles = param0
LasDataset = param1
defineCoord = param2
inCoord = param3
OutputLASDataset_lasd = param1 + "output.lasd"
arcpy.conversion.ConvertLas(in_las=LazFiles, target_folder=LasDataset, file_version="SAME_AS_INPUT", point_format="",compression="NO_COMPRESSION",
las_options=["REARRANGE_POINTS"], out_las_dataset=OutputLASDataset_lasd,define_coordinate_system=param2, in_coordinate_system=param3)
return
# This is used to execute code if the file was run but not imported
if __name__ == '__main__':
# Tool parameter accessed with GetParameter or GetParameterAsText
param0 = arcpy.GetParameterAsText(0)
param1 = arcpy.GetParameterAsText(1)
param2 = arcpy.GetParameterAsText(2)
param3 = arcpy.GetParameterAsText(3)
"GEOGCS['GCS_NAD_1983_2011',DATUM['D_NAD_1983_2011',SPHEROID['GRS_1980',6378137.0,298.257222101]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]]"
ScriptTool(param0, param1, param2, param3)
Solved! Go to Solution.
Yeah it looks like the spatial reference parameters were added to the convert LAS tool at ArcGIS Server 10.9.
I believe you'll need to publish from ArcGIS Pro 2.7 or lower (ideally 2.7 or 2.6) to get that to work.
Hi there,
It might be the version of ArcGIS Server you've got (10.8.1) does not have those two parameters available yet, they may have been added at a later version.
What version of ArcGIS Pro are you using?
Take note of this when publishing geoprocessing services - https://pro.arcgis.com/en/pro-app/latest/help/analysis/geoprocessing/share-analysis/geoprocessing-se...
I am using ArcGISPro 2.9.5
We are on ArcGIS Server 10.8.1
Is this issue related to the version of Pro and Server? One is expecting the 2 extra parameters and the other is expecting neither?
I thought by removing them from the script it would work but still getting the errors....
import arcpy
def ScriptTool(param0, param1):
print(param0)
print(param1)
LazFiles = param0
LasDataset = param1
OutputLASDataset_lasd = param1 + "output.lasd"
arcpy.conversion.ConvertLas(in_las=LazFiles, target_folder=LasDataset, file_version="SAME_AS_INPUT", point_format="",compression="NO_COMPRESSION",
las_options=["REARRANGE_POINTS"], out_las_dataset=OutputLASDataset_lasd)
return
# This is used to execute code if the file was run but not imported
if __name__ == '__main__':
# Tool parameter accessed with GetParameter or GetParameterAsText
param0 = arcpy.GetParameterAsText(0)
param1 = arcpy.GetParameterAsText(1)
ScriptTool(param0, param1)
Yeah it looks like the spatial reference parameters were added to the convert LAS tool at ArcGIS Server 10.9.
I believe you'll need to publish from ArcGIS Pro 2.7 or lower (ideally 2.7 or 2.6) to get that to work.
@sxw_eaglegis - Ok cool... well thats good news in a way that the code seems to be correct... I will give this a shot....Cheers