ArcGIS Pro

How to control the output symbology of your web tools or geoprocessing services

In ArcGIS Pro, you can apply many customized symbologies in many ways. There are also many advanced symbology options available. However, if you publish your analysis as web tools, you may lose your symbology settings if you do not follow the best practices.

In this blog, I will introduce you to the four most common ways to apply symbology to your result feature layers, even if you are using a feature class output in some cases. Regardless of which symbology option you choose, the general restrictions still apply. If your symbology is not supported in a map service or a feature service layer, you cannot use that symbology in your result web tool feature layer. Also, if you are using the output feature service, your symbology will not apply.

Result symbology for a model tool

There are two best ways to apply symbology for your result feature layer if you are using a model tool made by ModelBuilder. One is to set the output parameter property. Another is to use the Apply Symbology From Layer tool to apply the symbology as the last tool in your model.

Use the output parameter property

To set the output parameter property, go to the properties of your model tool in the Catalog pane. Once on the Tool Properties dialog box, select parameters to the left. You will see a table of your model parameters. The output parameter data type has to be a feature layer. Select an output feature parameter, and in the last column, Symbology, choose a layer file containing the symbology you want. To create a layer file, see Save a layer file.

Property of a model tool
Property of a model tool with Symbology column highlighted
Sample model
Sample model showing the additional Make Feature Layer tool

Once you have set up the output parameter symbology property, you also need to add the Make Feature Layer tool for your output. This can ensure the symbology is applied to the result feature layer correctly.

Use the Apply Symbology From Layer tool

Alternatively, you can add the Apply Symbology From Layer tool at the end of your model tool, if the parameter type of your output is a feature class.

Sample model using two additional tools
Sample model using two additional tools

If you plan to use the web tool in ArcGIS Pro, you also need to add a Copy Features tool in the end.

Result symbology for a script tool

Use the output parameter property

Your output parameter can be either a feature class or a feature layer. Similar to the model tool parameter property I introduced in the first section, you can add a layer file to the Symbology column of the output feature parameter.

Use the Apply Symbology From Layer tool

To use the Apply Symbology From Layer tool in your script tool, your output parameter has to be a feature layer. The feature set and feature class parameter types are not supported. Below is a sample code that shows an example of usage of the Apply Symbology From Layer tool.

import arcpy
infc = arcpy.GetParameterAsText(0)
outfc = arcpy.analysis.Buffer(infc, “%scratchgdb%/outfc”, “4 Kilometers”, “FULL”, “ROUND”, “NONE”, None, “PLANAR”)
updated = arcpy.ApplySymbologyFromLayer_management(outfc, r”E:\pro_projects\OutputSchema\dashcircle.lyrx”)
arcpy.SetParameter(1, updated)

Access your symbology at REST

If you are developing a web application, you can access the result feature layer symbology by using the returnFeatureCollection tag. By default, this option is false, when you will only get the feature set including feature geometries and field information. When this option set to true, you can see the drawing information JSON in the response. This option is available to both the GP Result resource for asynchronous services and the execute operation of synchronous services.

About the author

Simon is a product engineer on the geoprocessing services team since 2018. He works with different teams to improve the user experience of publishing and consuming geoprocessing services. Each year at the Esri User Conference and Developer Summit, he presents and supports users on topics related to geoprocessing services. Simon is also an opera lover and a world traveler.

Connect:
0 Comments
Inline Feedbacks
View all comments

Next Article

Key Esri UC Sessions for ArcGIS Online Users

Read this article