Please enable JavaScript to view this site.

Version:

Navigation: » No topics above this level «

Work with Symbols

Prev Top Next More

Symbols represent geometries on a map. Like geometries, symbols are usually associated with features—the geometry defines the feature's location and shape, and the symbol defines how to represent the geometry on the map. For example, you could use green circles to represent recycling depots, or you could fill flood-damaged parcels with blue.

To assign a symbol to a feature, you use the Set Feature Symbol activity, described in Set the Value for a Component. If the symbol already exists in the workflow, you can assign the existing symbol to the feature. For example, if the workflow already has a feature set with the desired symbol, set the Symbol input in the Set Feature Symbol activity to the existing symbol using an expression like one described in Use an Expression to Access a Feature or its Components.

If the symbol doesn't already exist in the workflow, you can create a new symbol using the Get Symbol From JSON activity, and then assign the symbol to the feature.

The type of symbol that you create depends on its purpose—different geometries call for different symbols, and three-dimensional maps use different symbols than two-dimensional maps. You can use the Get Symbol From JSON activity to create any of the symbols described in the Esri documentation.

Whatever type of symbol you decide to use, you can create the symbol by copying the JSON definition directly into the Get Symbol From JSON activity's Json input in Workflow Designer.

get-symbol-from-json-input

JSON definition of a symbol in the Get Symbol From JSON activity's Json input

Every symbol has a type property that defines what type of symbol it is. The other properties depend on the symbol type. Some of the properties are:

color: Color is represented as an array of RGBA values (0-255).

angle: Angles are measured in degrees (0-360) . Rotation is counter-clockwise. To measure an angle clockwise, use a negative value.

xoffset, yoffset: By default, offsets are measured in points. To use different units, specify the value and units as a string, for example: "xoffset" : "10px"

width: By default, widths are measured in points. To use different units, specify the value and units as a string, for example: "width" : "8px"

See also...

Esri Symbol 3.x 4.x

JSON for Symbols

Set the Symbol for a Feature

The Set Feature Symbol activity assigns a symbol to a feature. To use this activity, the symbol must already exist in the workflow.

To configure the Set Feature Symbol activity:

1.In the Feature input, specify the feature using one of the forms described in Use an Expression to Access a Feature or its Components.

For example, if you got the feature set from JSON, set the Features input to an expression similar to: =$featureSet1.featureSet.features[0]

2.Set the Symbol input to the symbol that you want to assign to the feature.

For example, if you created the symbol using the Get Symbol From JSON activity: =$symbol1.symbol

Access a Feature’s Symbol

To access the symbol for a particular feature in a feature set, you use an expression. The term that you use depends on which activity the feature set came from:

Query Layer: The Query Layer activity returns a feature set in the results output. The Query Layer activity also has a features output containing a collection of the features. Both outputs give you access to all the features in the feature set. Using the features output is shorter. In either case, the features are indexed numerically starting at zero: features[0], features[1], features[2], and so on.

Symbols are not stored with feature data, so queries cannot return symbols. However, you can assign symbols to the features returned by a query using the Set Feature Symbol activity. After assigning symbols, you can access the symbol for a particular feature using a term similar to one of the following in an expression:

$query1.results.features[0].symbol

or

$query1.features[0].symbol

If you try to access the symbol in a feature that does not have a symbol, $query1.results.features[0].symbol and $query1.features[0].symbol will be undefined.

Create Feature Set, Get Feature Set From JSON: The Create Feature Set and Get Feature Set From JSON activities return a feature set in the featureSet output. The features are indexed numerically starting at zero: features[0], features[1], features[2], and so on.

To access the symbol for a particular feature in a feature set returned by one of these activities, use a term similar to the following in an expression:

$featureSet1.featureSet.features[0].symbol

If you try to access the symbol in a feature that does not have a symbol, $featureSet1.featureSet.features[0].symbol will be undefined.

Create a Simple Marker Symbol

Simple marker symbols are simple geometric shapes like circles, squares, or diamonds. They can be used to represent points in two-dimensional maps. To define a simple marker symbol, set the type property to esriSMS.

Example- JSON for a Simple Marker Symbol

This example shows the JSON for a simple marker symbol ("type" : "esriSMS"). The symbol has the following properties:

style: The marker is a cross (esriSMSCross).

Other available styles are circle (esriSMSCircle), diamond (esriSMSDiamond), square (esriSMSSquare), X (esriSMSX), and triangle (esriSMSTriangle). The default is esriSMSCircle.

color: The marker is red (255,0,0) and fully opaque (255).

size: The marker is 10 points in size.

By default, sizes are measured in points. To use different units, specify the value and units as a string, for example: "size" : "2px"

angle: The marker is not rotated.

xoffset, yoffset: The marker is positioned directly over the geometry.

outline: The marker has a black (0,0,0) outline that is fully opaque (255) and 1 point wide.

If you don't want the marker to have an outline, set the outline property to: { "style" : "esriSLSNull" }

{
   "type": "esriSMS",
   "style": "esriSMSCross",
   "color": [255,0,0,255],
   "size": 10,
   "angle": 0,
   "xoffset": 0,
   "yoffset": 0,
   "outline":
   {
      "color": [0,0,0,255],
      "width": 1
   }
}

Create a Simple Line Symbol

Simple line symbols are used to represent polylines in two-dimensional maps. You can also use simple line symbols for the outlines of simple fill symbols. To define a simple line symbol, set the type property to esriSLS.

Example - JSON for a Simple Line Symbol

This example shows the JSON for a simple line symbol ("type": "esriSLS"). The symbol has the following properties:

style: The line is solid (esriSLSSolid).

Other available styles are dash (esriSLSDash), dash-dot (esriSLSDashDot), dash-dot-dot (esriSLSDashDotDot), dot (esriSLSDot), and null (esriSLSNull). Use the null style to ensure that a symbol does not have an outline.

color: The line is aqua (0,255,255) and slightly transparent (200).

width: The line is 4 points wide.

{
   "type": "esriSLS",
   "style": "esriSLSSolid",
   "color": [0,255,255,200],
   "width": 4
}

Create a Simple Fill Symbol

Simple fill symbols are used to represent polygons in two-dimensional maps. To define a simple fill symbol, set the type property to esriSFS.

Example - JSON for a Simple Fill Symbol

This example shows the JSON for a simple fill symbol ("type": "esriSFS"). The symbol has the following properties:

style: The fill is solid (esriSMSSolid).

Other available styles are backward diagonal (esriSFSBackwardDiagonal), cross (esriSFSCross), diagonal cross (esriSFSDiagonalCross), forward diagonal (esriSFSForwardDiagonal), horizontal (esriSFSHorizontal), null (esriSFSNull), and vertical (esriSFSVertical). Use the null style to ensure that a symbol is not filled.

color: The fill is yellow (255,255,0) and rather transparent (100).

outline: The symbol has a dashed (esriSLSDash), orange (255,165,0) outline that is slightly transparent (200) and 2 points wide.

{
   "type": "esriSFS",
   "style": "esriSFSSolid",
   "color": [255,255,0,100],
   "outline":
   {
      "style" : "esriSLSDash",
      "color": [255,165,0,200],
      "width": 2
   }
}

Create a Picture Marker Symbol

Picture marker symbols are images that are used to represent points in two-dimensional maps. To define a picture marker symbol, set the type property to esriPMS.

Example - JSON for a Picture Marker Symbol

This example shows the JSON for a picture marker symbol ("type" : "esriPMS"). The symbol has the following properties:

url: The image is located at https://static.arcgis.com/images/Symbols/SafetyHealth/FireStation.png.

For more information on URLs, see "Picture Marker Symbol" in the Esri documentation.

height: The image is resized to 6 points in height. Omitting the width property adjusts the width proportionately to the specified height.

To display the image at its actual size, omit both the height and width properties. To use different units than points, specify the value and units as a string, for example: "height" : "20px"

angle: The image is rotated clockwise by 30 degrees.

xoffset, yoffset: The image is positioned directly over the geometry.

{
   "type": "esriPMS",
   "url" : "https://static.arcgis.com/images/Symbols/SafetyHealth/FireStation.png",
   "height": 6,
   "angle": -30,
   "xoffset": 0,
   "yoffset": 0
}

© 2024 VertiGIS North America Ltd. All Rights Reserved. | Privacy Center | Imprint
Documentation Version 5.42 (220a4365)