Unique types

USA freeways styled with a unique value renderer displaying freeway types

What is a unique types style?

A unique types style assigns distinct symbols to unique data values returned from a field or expression in a layer. You can use this style to visualize what something represents, such as:

  • Show points of interest on a map (e.g. schools, parks, places of worship)
  • Represent categories of data (e.g. regions, types)
  • Visualize ordinal data (e.g. High, medium, and low)

How a unique types style works

This style is configured with a Unique Value Renderer. This renderer requires the following:

  1. A reference to a data value either from a field name, or an Arcade expression.
  2. A list of unique value infos that match a unique symbol with an expected value returned from the field or expression.

Examples

Categorical data

This example demonstrates how to visualize categories using a string value. The app visualizes freeways based on their classification: interstate, state highway, or U.S. highway.

  1. Create a unique value renderer.
  2. Reference the field name containing the classification values.
  3. Create unique value info objects and assign a symbol to each expected value.
  4. You can optionally add a default symbol to represent all features that don't have a matching value.
ArcGIS JS APIArcGIS .NET APIArcGIS Android APIArcGIS iOS APIArcGIS Java APIArcGIS Qt API (C++)ArcGIS Qt API (QML)
41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 76 76 76 76 76 76 76 76 76 76 76 76 76 76 76 76 76 76 76 76 76 76 76 76 76 76 76 76 76 76 76 76 76 76 76 76 76 76 76 76 76 76 76 76 76
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8" />
    <meta
      name="viewport"
      content="initial-scale=1,maximum-scale=1,user-scalable=no"
    />
    <title>
      ArcGIS Developer Guide: Unique types
    </title>

    <link
      rel="stylesheet"
      href="https://js.arcgis.com/4.18//esri/themes/dark/main.css"
    />
    <script src="https://js.arcgis.com/4.18//"></script>

    <style>
      html,
      body,
      #viewDiv {
        padding: 0;
        margin: 0;
        height: 100%;
        width: 100%;
        background-color: rgba(15, 15, 15, 1);
      }
    </style>

    <script>
      require([
        "esri/config",
        "esri/Map",
        "esri/views/MapView",
        "esri/layers/FeatureLayer",
        "esri/widgets/Legend"
      ], function (esriConfig,Map, MapView, FeatureLayer, Legend) {

        esriConfig.apiKey = "YOUR-API-KEY";

        const hwyRenderer = {
          type: "unique-value",
          legendOptions: {
            title: "Freeway type"
          },
          field: "CLASS",
          uniqueValueInfos: [{
            value: "S",
            label: "State highway",
            symbol: {
              type: "simple-line",
              color: "#e6d800",
              width: "6px",
              style: "solid"
            }
          }, {
            value: "I",
            label: "Interstate",
            symbol: {
              type: "simple-line",
              color: "#e60049",
              width: "6px",
              style: "solid"
            }
          }, {
            value: "U",
            label: "US Highway",
            symbol: {
              type: "simple-line",
              color: "#9b19f5",
              width: "6px",
              style: "solid"
            }
          }]
        };


        // Set the renderer on the layer
        const hwyLayer = new FeatureLayer({
          url:
            "https://services.arcgis.com/P3ePLMYs2RVChkJx/ArcGIS/rest/services/USA_Freeway_System/FeatureServer/2",
          renderer: hwyRenderer,
          title: "USA Freeway System",
          minScale: 0,
          maxScale: 0
        });

        // Add the layer to the map
        const map = new Map({
          basemap: {
            portalItem: {
              id: "56b5bd522c52409c90d902285732e9f1"
            }
          },
          layers: [hwyLayer]
        });

        const view = new MapView({
          container: "viewDiv",
          map: map,
          center: [-93.20, 44.917 ],
          scale: 577790.5542885,
          constraints: {
            snapToZoom:false
          }
        });

        const legend = new Legend({
          view: view
        });

        view.ui.add(legend, "bottom-right");
      });
    </script>
  </head>

  <body>
    <div id="viewDiv"></div>
  </body>
</html>

Ordinal data

This example demonstrates how to create ordinal categories from a numeric field attribute using an Arcade expression. This app classifies highways by low medium or high truck traffic.

First, write an Arcade expression to classify the data into ordinal categories: low, medium, and high.

32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 33 34 35 36 37 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8" />
    <meta
      name="viewport"
      content="initial-scale=1,maximum-scale=1,user-scalable=no"
    />
    <title>
      ArcGIS Developer Guide: Arcade-Unique types
    </title>

    <link
      rel="stylesheet"
      href="https://js.arcgis.com/4.18//esri/themes/light/main.css"
    />
    <script src="https://js.arcgis.com/4.18//"></script>

    <style>
      html,
      body,
      #viewDiv {
        padding: 0;
        margin: 0;
        height: 100%;
        width: 100%;
        background-color: rgba(15, 15, 15, 1);
      }
    </style>

    <script type="text/arcade" id="traffic-classification">

      var traffic = $feature.AADT;
      When(
        traffic > 80000, "High",
        traffic > 20000, "Medium",
        "Low"
      );

    </script>

    <script>
      require([
        "esri/config",
        "esri/Map",
        "esri/views/MapView",
        "esri/layers/FeatureLayer",
        "esri/widgets/Legend",
        "esri/widgets/Expand"
      ], function (esriConfig,Map, MapView, FeatureLayer, Legend, Expand) {

        esriConfig.apiKey = "YOUR-API-KEY";

        const renderer = {
          type: "unique-value",
          valueExpression: `
            var traffic = $feature.AADT;
            When(
              traffic > 80000, "High",
              traffic > 20000, "Medium",
              "Low"
            );
          `,
          valueExpressionTitle: "Traffic volume",
          uniqueValueInfos: [{
            value: "High",
            symbol: {
              type: "simple-line",
              color: "#810f7c",
              width: "6px",
              style: "solid"
            }
          }, {
            value: "Medium",
            symbol: {
              type: "simple-line",
              color: "#8c96c6",
              width: "3px",
              style: "solid"
            }
          }, {
            value: "Low",
            symbol: {
              type: "simple-line",
              color: "#9d978b",
              width: "1px",
              style: "solid"
            }
          }]
        };


        // Set the renderer on the layer
        const layer = new FeatureLayer({
          url: "https://services.arcgis.com/V6ZHFr6zdgNZuVG0/arcgis/rest/services/Florida_Annual_Average_Daily_Traffic/FeatureServer/0",
          renderer: renderer,
          title: "Annual average daily traffic",
          minScale: 0,
          maxSclae: 0
        });

        // Add the layer to the map
        const map = new Map({
          basemap: "arcgis-light-gray",
          layers: [layer]
        });

        const view = new MapView({
          container: "viewDiv",
          map: map,
          center: [-80.215, 25.856 ],
          rotation: 90,
          scale: 144447,
          constraints: {
            snapToZoom:false
          }
        });

        view.ui.add(new Expand({
          content:  new Legend({
            view: view
          }),
          view: view,
          expanded: true
        }), "top-right");
      });
    </script>
  </head>

  <body>
    <div id="viewDiv"></div>
  </body>
</html>
  1. Create a unique value renderer.
  2. Reference the Arcade expression in the valueExpression property.
  3. Create unique value info objects and assign a symbol to each expected value.
  4. You can optionally add a default symbol to represent all features that don't have a matching value.
ArcGIS JS API
53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8" />
    <meta
      name="viewport"
      content="initial-scale=1,maximum-scale=1,user-scalable=no"
    />
    <title>
      ArcGIS Developer Guide: Arcade-Unique types
    </title>

    <link
      rel="stylesheet"
      href="https://js.arcgis.com/4.18//esri/themes/light/main.css"
    />
    <script src="https://js.arcgis.com/4.18//"></script>

    <style>
      html,
      body,
      #viewDiv {
        padding: 0;
        margin: 0;
        height: 100%;
        width: 100%;
        background-color: rgba(15, 15, 15, 1);
      }
    </style>

    <script type="text/arcade" id="traffic-classification">

      var traffic = $feature.AADT;
      When(
        traffic > 80000, "High",
        traffic > 20000, "Medium",
        "Low"
      );

    </script>

    <script>
      require([
        "esri/config",
        "esri/Map",
        "esri/views/MapView",
        "esri/layers/FeatureLayer",
        "esri/widgets/Legend",
        "esri/widgets/Expand"
      ], function (esriConfig,Map, MapView, FeatureLayer, Legend, Expand) {

        esriConfig.apiKey = "YOUR-API-KEY";

        const renderer = {
          type: "unique-value",
          valueExpression: `
            var traffic = $feature.AADT;
            When(
              traffic > 80000, "High",
              traffic > 20000, "Medium",
              "Low"
            );
          `,
          valueExpressionTitle: "Traffic volume",
          uniqueValueInfos: [{
            value: "High",
            symbol: {
              type: "simple-line",
              color: "#810f7c",
              width: "6px",
              style: "solid"
            }
          }, {
            value: "Medium",
            symbol: {
              type: "simple-line",
              color: "#8c96c6",
              width: "3px",
              style: "solid"
            }
          }, {
            value: "Low",
            symbol: {
              type: "simple-line",
              color: "#9d978b",
              width: "1px",
              style: "solid"
            }
          }]
        };


        // Set the renderer on the layer
        const layer = new FeatureLayer({
          url: "https://services.arcgis.com/V6ZHFr6zdgNZuVG0/arcgis/rest/services/Florida_Annual_Average_Daily_Traffic/FeatureServer/0",
          renderer: renderer,
          title: "Annual average daily traffic",
          minScale: 0,
          maxSclae: 0
        });

        // Add the layer to the map
        const map = new Map({
          basemap: "arcgis-light-gray",
          layers: [layer]
        });

        const view = new MapView({
          container: "viewDiv",
          map: map,
          center: [-80.215, 25.856 ],
          rotation: 90,
          scale: 144447,
          constraints: {
            snapToZoom:false
          }
        });

        view.ui.add(new Expand({
          content:  new Legend({
            view: view
          }),
          view: view,
          expanded: true
        }), "top-right");
      });
    </script>
  </head>

  <body>
    <div id="viewDiv"></div>
  </body>
</html>

Categorical data (3D)

This example visualizes buildings based on the type of building: residential, commercial or mixed use. A unique value renderer assigns a color to each building based on the building's usage attribute.

Steps

  1. Create different symbols for each building type.
  2. Assign the symbols to a unique value renderer.
  3. Assign the renderer to the scene layer.
ArcGIS JS API
37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8" />
    <meta
      name="viewport"
      content="initial-scale=1,maximum-scale=1,user-scalable=no"
    />
    <title>
      ArcGIS Developer Guide: Visualize buildings by type
    </title>

    <link rel="stylesheet" href="https://js.arcgis.com/4.18//esri/themes/light/main.css" />
    <script src="https://js.arcgis.com/4.18//"></script>

    <style>
      html,
      body,
      #viewDiv {
        padding: 0;
        margin: 0;
        height: 100%;
        width: 100%;
      }
    </style>

    <script>
      require([
        "esri/config",
        "esri/Map",
        "esri/views/SceneView",
        "esri/layers/SceneLayer",
        "esri/widgets/Legend",
      ], function(esriConfig,Map, SceneView, SceneLayer, Legend) {

        esriConfig.apiKey = "YOUR-API-KEY";

        const typeRenderer = {
          type: "unique-value",
          legendOptions: {
            title: "Building Type",
          },
          defaultSymbol: {
            type: "mesh-3d",
            symbolLayers: [
              {
                type: "fill",
                material: { color: "#FFB55A", colorMixMode: "replace" },
              },
            ],
            value: "Others"
          },
          field: "landuse",
          uniqueValueInfos: [
            {
              value: "MIPS",
              symbol: {
                type: "mesh-3d",
                symbolLayers: [
                  {
                    type: "fill",
                    material: { color: "#FD7F6F", colorMixMode: "replace" },
                  },
                ],
              },
              label: "Office",
            },
            {
              value: "RESIDENT",
              symbol: {
                type: "mesh-3d",
                symbolLayers: [
                  {
                    type: "fill",
                    material: { color: "#7EB0D5", colorMixMode: "replace" },
                  },
                ],
              },
              label: "Residential",
            },
            {
              value: "MIXRES",
              symbol: {
                type: "mesh-3d",
                symbolLayers: [
                  {
                    type: "fill",
                    material: { color: "#BD7EBE", colorMixMode: "replace" },
                  },
                ],
              },
              label: "Mixed use",
            },
            {
              value: "MIXED",
              symbol: {
                type: "mesh-3d",
                symbolLayers: [
                  {
                    type: "fill",
                    material: { color: "#B2E061", colorMixMode: "replace" },
                  },
                ],
              },
              label: "Mixed use without residential",
            },
          ],
        }


        // Set the renderer on the layer
        const buildingLayer = new SceneLayer({
          url:
            "https://services.arcgis.com/V6ZHFr6zdgNZuVG0/ArcGIS/rest/services/SF_BLDG_WSL1/SceneServer/0",
          renderer: typeRenderer,
          title: "San Francisco Buildings",
        })

        // Add the layer to the map
        const map = new Map({
         basemap: "arcgis-light-gray",
          layers: [buildingLayer],
        })

        const view = new SceneView({
          container: "viewDiv",
          map: map,
          camera: {
            position: [-122.3966368, 37.77924265, 1294.5539],
            heading: 346.67,
            tilt: 46.8,
          },
        })

        const legend = new Legend({
          view: view,
        })

        view.ui.add(legend, "top-right")
      })
    </script>
  </head>

  <body>
    <div id="viewDiv"></div>
  </body>
</html>

Tutorials

Services

Feature service

Add, update, delete, and query feature data.

API support

Different APIs have different levels of support for data-driven visualization.

Unique typesClass breaksVisual variablesTimeMultivariatePredominanceDot densityRelationship
ArcGIS JS APIFully supportedFully supportedFully supportedFully supportedFully supportedFully supportedFully supportedFully supported
ArcGIS Android APIFully supportedFully supportedFully supportedFully supportedFully supportedFully supportedNot supportedFully supported
ArcGIS iOS APIFully supportedFully supportedFully supportedFully supportedFully supportedFully supportedNot supportedFully supported
ArcGIS .NET APIFully supportedFully supportedFully supportedFully supportedFully supportedFully supportedNot supportedFully supported
ArcGIS Qt APIFully supportedFully supportedFully supportedFully supportedFully supportedFully supportedNot supportedFully supported
ArcGIS Java APIFully supportedFully supportedFully supportedFully supportedFully supportedFully supportedNot supportedFully supported
ArcGIS Python APIFully supportedFully supportedFully supportedFully supportedFully supportedFully supportedNot supportedFully supported
Full supportPartial support (see notes)Not supported

Tools