AnsweredAssumed Answered

Geoprocessing service Resultats do not show

Question asked by saidakif on Nov 14, 2017
Latest reply on Nov 20, 2017 by saidakif


I created a geoprocessing service that I published it in our ArcGIS server. After,  I created a web map application with Web AppBuilder and using a geoprocessing widget I was able to call my GPS and execute it without any error.

The problem is that I can not see the results. I tried arcpy.AddMessage() and also acpy.MakeFeatureLayer_management() but no results. Regarding Addmessage, instead of calling mxd = arcpy.mapping.MapDocument, I just create some variable, did my calculation and add the results to and AddMessage()

Here is my code. At the bottom, my addMessage code.


import arcpy
import os
from arcpy import env

env.outputZFlag = "DISABLED" 
env.outputMFlag = "DISABLED"

mxdfile = "\\\\vsonkengis01\\Oceans\\Projects\\2017\\GPS\\AreaMCT\\Mxd\\AreaMCT.mxd"
mxd = arcpy.mapping.MapDocument (mxdfile)
df = arcpy.mapping.ListDataFrames(mxd,"Layers")[0]
# Set all the parameters
fClass1 = arcpy.GetParameterAsText(0)
fClass2 = arcpy.GetParameterAsText(1)
fClass3 = arcpy.GetParameterAsText(2)
fClass4 = arcpy.GetParameterAsText(3)
Union1 = "\\\\vsonkengis01\\Oceans\\Projects\\2017\\GPS\\AreaMCT\\Scratch\\Scratch.gdb\\Union1"
Union = "\\\\vsonkengis01\\Oceans\\Projects\\2017\\GPS\\AreaMCT\\Scratch\\Scratch.gdb\\Union"
Union_Diss = "\\\\vsonkengis01\\Oceans\\Projects\\2017\\GPS\\AreaMCT\\Scratch\\Scratch.gdb\\Union_Diss"
Union_Diss_inter = "\\\\vsonkengis01\\Oceans\\Projects\\2017\\GPS\\AreaMCT\\Scratch\\Scratch.gdb\\Union_Diss_inter"
Union_Diss_inters = "\\\\vsonkengis01\\Oceans\\Projects\\2017\\GPS\\AreaMCT\\Scratch\\Scratch.gdb\\Union_Diss_inters"
# Union
arcpy.Union_analysis ([fClass1, fClass2], Union1, "ONLY_FID")
arcpy.Union_analysis ([Union1, fClass3],Union, "ONLY_FID")
# Generalization
arcpy.Dissolve_management (Union, Union_Diss, "Diss","","MULTI_PART")
# Intersect
arcpy.Intersect_analysis([Union_Diss, fClass4], Union_Diss_inter,"ALL")
arcpy.Dissolve_management (Union_Diss_inter, Union_Diss_inters, "Name","","MULTI_PART")
arcpy.AddField_management(Union_Diss_inters, "TArea", "DOUBLE")
arcpy.AddField_management(Union_Diss_inters, "AreaEEZ", "DOUBLE")
arcpy.AddField_management(Union_Diss_inters, "PTArea", "DOUBLE")
arcpy.CalculateField_management(Union_Diss_inters, "AreaEEZ", exp, "PYTHON_9.3")
TArea = 0
urows = arcpy.UpdateCursor(Union_Diss_inters)
for row in urows:
    TArea += row.getValue("AreaEEZ")
del urows
urows = arcpy.UpdateCursor(Union_Diss_inters)
for row in urows:
    row.setValue("TArea", TArea)
    if row.getValue("Name")=="Atlantic and Arctic":
       row.setValue("PTArea", (row.getValue("AreaEEZ")/TArea)*100)
    if row.getValue("Name")=="Pacific":
       row.setValue("PTArea", (row.getValue("AreaEEZ")/TArea)*100) 
del urows
if arcpy.Exists("AreaMCT"):
arcpy.MakeFeatureLayer_management(Union_Diss_inters, "AreaMCT")
layer = arcpy.mapping.Layer("AreaMCT")
layer.visible = True
arcpy.mapping.AddLayer(df, layer, "TOP")



arcpy.AddMessage("Total Atrea Protected = " + str(TArea) + " km2")
arcpy.AddMessage("Area protected in Pacific EEZ = " + str(TAreaPacific) + " km2" )
arcpy.AddMessage("Percentage Area protected in Pacific EEZ = " + str(PTAreaPacific*100) + " %" )
arcpy.AddMessage("Area protected in Atlantic-Arctic EEZ = " + str(TAreaATArcti) + " km2" )
arcpy.AddMessage("Percentage Area protected in Atlantic-Arctic EEZ = " + str(PTAreaATArcti*100) + " %" )


An other question:

The GPS is related to a set of data. When I published the GPS, used a registered path for the data. So, the data is not copied to the server.

How can I load the data related to this GPS? do I have to publish a WMS the the same registed path and load it into t Web Map?


Thanks a lot