[GIS] Error 000628: Cannot set input into parameter out_layer when executing MakeFeatureLayer

arcgis-serverarcpyerror-000628

I have a script that runs fine in ArcMap and when published to ArcGIS Server:

  1. it runs fine when using folder workspace i.e GDB database.
  2. fails when using ArcSDE workspace to connect to a RDBMS.

This is my script. The problematic line is indicated by a comment.

    arcpy.env.overwriteOutput=True      
    arcpy.env.workspace= params[3].valueAsText
    coverageDirName="tempCoverage"
    coverageOutDir=tempfile.gettempdir()+"\\"+coverageDirName                       

    arcpy.CreateFeatureclass_management(params[3].valueAsText, "points", "POINT")
    arcpy.AddField_management("points","featureClassName","TEXT")       
    arcpy.AddField_management("points","OriginalOBJECTID","Integer")



    linesObjIdFldMap = arcpy.FieldMap()     
    for fc in params[0].values:                 
        linesObjIdFldMap.addInputField(fc,"OBJECTID")                   
    linesObjectId=linesObjIdFldMap.outputField
    linesObjectId.name="OriginalOBJECTID"
    linesObjectId.type="Integer"
    linesObjIdFldMap.outputField =linesObjectId

    linesFeatureClassFldMap = arcpy.FieldMap()          
    linesFeatureClassFldMap.addInputField(params[0].values[0],"featureClassName")   
    linesFeatureClassName=linesFeatureClassFldMap.outputField
    linesFeatureClassName.name="featureClassName"
    linesFeatureClassFldMap.outputField =linesFeatureClassName

    lineFieldMappings = arcpy.FieldMappings()
    lineFieldMappings.addFieldMap(linesObjIdFldMap) 
    lineFieldMappings.addFieldMap(linesFeatureClassFldMap)

    pointsObjIdFldMap = arcpy.FieldMap()                    
    for fc in params[1].values:     
        pointsObjIdFldMap.addInputField((fc),"OBJECTID")
    pointsObjectId=pointsObjIdFldMap.outputField
    pointsObjectId.name="OriginalOBJECTID"
    pointsObjectId.type="Integer"
    pointsObjIdFldMap.outputField =pointsObjectId

    pointsFeatureClassFldMap = arcpy.FieldMap()         
    pointsFeatureClassFldMap.addInputField(params[0].values[0],"featureClassName")  
    pointsFeatureClassName=pointsFeatureClassFldMap.outputField
    pointsFeatureClassName.name="featureClassName"
    pointsFeatureClassFldMap.outputField =pointsFeatureClassName

    pointFieldMappings = arcpy.FieldMappings()
    pointFieldMappings.addFieldMap(pointsFeatureClassFldMap)
    pointFieldMappings.addFieldMap(pointsObjIdFldMap)       

    arcpy.Merge_management(params[0].values,"lines",lineFieldMappings)
    arcpy.Append_management(params[1].values,"points","NO_TEST",pointFieldMappings)

    inputFeatures="'{0}\\lines' ARC; '{0}\\points' POINT;".format(arcpy.env.workspace)  
    arcpy.FeatureclassToCoverage_conversion(in_features=inputFeatures,out_cover=coverageOutDir)             
    #arcpy.env.workspace=params[3].valueAsText
    arcpy.FeatureClassToGeodatabase_conversion([coverageOutDir+"\\arc",coverageOutDir+"\\node"],params[3].valueAsText)  



# this line throws error
    result=arcpy.MakeFeatureLayer_management(in_features="tempCoverage_node",   out_layer="nodes_lyr")  
    arcpy.SetParameter(4,result.getOutput(0))
    result=arcpy.MakeFeatureLayer_management(in_features="tempCoverage_arc", out_layer="arcs_lyr")      
    arcpy.SetParameter(2,result.getOutput(0))

The environment is ArcGis Server 10.2.2 connecting to remote sde database.

The input workspace is set to the sde connection file located in the root drive (c:\data) with its permissions set to allow full control by ArcGis Server account.

I have tried forward slashes, double backslashes and concatenating the path for the in_features parameter instead of relying on the workspace variable, to no avail

Best Answer

I had the same error message in my geoprocessing service (Error 000628: Cannot set input into parameter out_layer). I haven't found the real root cause. As a workaround, I used a different value / name for the output_layer variable. It seems that the former name is not useable anymore, even after restarting the service. Maybe re-deploying the service can fix the problem, I didn't try that.

Hint: Pay attention to the error message, it clearly states that output_layer is the problem, not in_features. So trying to fix something in in_features will not help (although the error messages from Esri ArcGIS do not always point in the right direction).

Related Question