AnsweredAssumed Answered

Arcpy GPServer - Group Layer as Result Map Service

Question asked by tolgaster22 on Oct 23, 2017
Latest reply on Nov 2, 2017 by tolgaster22

Hello,

When I publish the KmlToLayer as below, I can publish the Group Layer as a map service. Gp Server publishes group layer parameter type as GpString and can display it as Map Service.

But when I try to do the same output with Arcpy as follows, the lyr file is only recognized as a file and the result map service is empty.

result_gl = arcpy.mapping.ListLayers(mxd, "GroupLayer", df)[0]
# ...
result_group_layer_path = arcpy.env.scratchWorkspace + "\\" + "scratch.lyr"
arcpy.SaveToLayerFile_management(result_gl , result_group_layer_path)
# ...
# Only this one adds result layer to display others not.
arcpy.SetParameterAsText(1, result_group_layer_path)
# Or
# arcpy.SetParameter(1, result_gl)
# Or
# arcpy.SetParameter(1, arcpy.mapping.Layer(result_group_layer_path))

When I publish this with "View results with a map service option" , the output parameter is as follows not as a map service.

{
"paramName": "RESULT",
"dataType": "GPDataFile",
"value": {
  "url": "https://....gpserver/j069a1ca799304125882f8e172a4626b5/scratch/scratch.lyr"
}
}

What is the difference between the KmlToLayer model above and the my ArcPy model outputs?

What should I do in order for the ArcGIS server to display the result lyr file (group layer) as a map service?

Outcomes