I have created a model in modelbuilder that takes an interactive feature set as a parameter so that the user of the model can draw a polygon "on the fly". I take the interactive feature set and use the Copy Features tool so that I can make the "in_memory" feature set a new feature layer. I have 3 different symbology layers (red, green, yellow) located on the local hard drive of my computer. I use the ApplySymbologyfromLayer_management tool to set the symbology based on a simple if else statement.

This process works with zero problems in modelbuilder in ArcMap. However, when i publish it as a gp service and use it in the geoprocessing widget of ArcGIS Online Web Appbuilder. The symbology layers i have used cannot be found.

Now I know the reason is because the symbology layer is located on my computer but my question is...

Is there a way to use a symbology layer in ArcGIS online web appbuilder for geoprocessing? If that is not possible, what are the alternatives to changing the feature layer to a specific color (i.e red, green, yellow) using arcpy?

I have seen cartographic represenation as a possible workaround however the documentation is kinda confusing and does not really show me how the Rule IDs change the symbology. I am using ArcMap 10.5 and i do not have Web appbuilder (dev edition).

Here is the error I got from the gp widget in ArcGIS online Web Appbuilder: ERROR 000732: Symbology Layer: Dataset C:\Documents\SymbologyLayer\yellow.lyr does not exist or is not supported Failed to execute (ApplySymbologyFromLayer).

Here is the code:

def getSymbology(userArea, category):

arcpy.env.overwriteOutput = True
#Copy in memory feature set to in memory copied features
copiedArea =r'in_memory\copiedArea' 
arcpy.CopyFeatures_management(userArea, copiedArea)

#Set name of new users feature layer based on category type
if category == "Open Category":
    userLayer = "Open"
elif category == "Specific Category":
   userLayer = "Specific"
  userLayer = 'Certified'

arcpy.MakeFeatureLayer_management(copiedArea, userLayer)

# Set symbology layers
openLayer = r"C:\Documents\SymbologyLayer\green.lyr"

specificLayer = r"C:\Documents\SymbologyLayer\yellow.lyr"

certifiedLayer = r"C:\Documents\SymbologyLayer\red.lyr"

#If category matches the string then apply symbology
if category == "Open Category":
    arcpy.ApplySymbologyFromLayer_management(userLayer, openLayer)
elif category == "Specific Category":
    arcpy.ApplySymbologyFromLayer_management(userLayer, specificLayer)
    arcpy.ApplySymbologyFromLayer_management(userLayer, certifiedLayer)
  • Skip ArcGIS Online for now. Can you run the tool from a Use connection to the ArcGIS Server from ArcMap on your laptop? How about from someone else's machine? Are you publishing the GP service with a map service to render the results? – Simon Oct 3 '18 at 10:39
  • And use relative paths for the layer files. pro.arcgis.com/en/pro-app/help/analysis/geoprocessing/… Are you also copying data to the GIS Server when publishing? Does ArcGIS Server have permissions to your local drive, likely not. – Simon Oct 3 '18 at 10:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.