Click or drag to resize

DictionaryRenderer Class

Renders geoelements using symbols generated from a DictionarySymbolStyle.
Inheritance Hierarchy
SystemObject
  Esri.ArcGISRuntime.SymbologyRenderer
    Esri.ArcGISRuntime.SymbologyDictionaryRenderer

Namespace:  Esri.ArcGISRuntime.Symbology
Assembly:  Esri.ArcGISRuntime (in Esri.ArcGISRuntime.dll) Version: 100.11.0
Syntax
public class DictionaryRenderer : Renderer

The DictionaryRenderer type exposes the following members.

Constructors
Properties
  NameDescription
Public propertyIsTextVisible Obsolete.
Gets or sets the visibility for the text on the symbol.
Public propertyCode exampleRotationExpression
Gets/sets the expression describing how a Graphic's attributes are translated into a rotation to be applied to the Graphic.
(Inherited from Renderer.)
Public propertyRotationType
Gets/sets whether the rotation calculated from the RotationExpression is screen- or map-relative.
(Inherited from Renderer.)
Public propertyScaleExpression
Gets or sets an arcade expression object with an expression for scaling symbols in a dictionary renderer.
Public propertyCode exampleSceneProperties
Gets or sets the scene properties for the renderer.
(Inherited from Renderer.)
Public propertySymbolDictionaryStyle
Gets or sets the dictionary symbol style to be applied by the renderer.
Public propertySymbologyFieldOverrides
Gets or sets the dictionary of a symbology attribute and its override used to fetch a symbol from the dictionary symbol style.
Public propertyTextFieldOverrides
Gets or sets the map of a text attribute and its override used to fetch symbol text and placement from the dictionary symbol style.
Public propertyTextVisibilityMaxScale Obsolete.
Gets or sets the maximum scale for 2D or distance for 3D at which symbol's text will be visible.
Public propertyTextVisibilityMinScale Obsolete.
Gets or sets the minimum scale for 2D or distance for 3D at which symbol's text will be visible.
Public propertyUnknownJson
Gets unknown data from the source JSON.
(Inherited from Renderer.)
Public propertyUnsupportedJson
Gets unsupported data from the source JSON.
(Inherited from Renderer.)
Top
Methods
  NameDescription
Public methodCode exampleClone
Returns a clone of the Renderer.
(Inherited from Renderer.)
Public methodGetSymbol(GeoElement)
Returns the symbol the renderer uses to represent the supplied GeoElement.
(Inherited from Renderer.)
Public methodGetSymbol(GeoElement, Boolean)
Returns the symbol that should be used to visualize the given GeoElement with override attributes from renderer.
(Inherited from Renderer.)
Public methodToJson
Returns the json representation of the renderer
(Inherited from Renderer.)
Top
Events
  NameDescription
Public eventPropertyChanged
Occurs when a property value changes.
(Inherited from Renderer.)
Top
Remarks

The DictionaryRenderer applies symbols to features or graphics according to a set of input attribute values.The symbol primitives and logic(rule engine) for applying symbols is provided by an associated DictionarySymbolStyle The DictionarySymbolStyle depends on attribute names to define the symbology of each feature. The attributes reference different symbol components in the style, which are assembled to create a complex symbol. In order to display geoelements using the DictionaryRenderer, attributes in your data must either use the expected attribute names or be mapped to the proper style attributes.

Examples

WPF

Example Name: CustomDictionaryStyle

Use a custom dictionary style (.stylx) to symbolize features using a variety of attribute values.

Code example screen shot.

C#
// Copyright 2019 Esri.
// 
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
// You may obtain a copy of the License at: http://www.apache.org/licenses/LICENSE-2.0
// 
// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific
// language governing permissions and limitations under the License.

using ArcGISRuntime.Samples.Managers;
using Esri.ArcGISRuntime.Mapping;
using Esri.ArcGISRuntime.Symbology;
using System;

namespace ArcGISRuntime.WPF.Samples.CustomDictionaryStyle
{
    [ArcGISRuntime.Samples.Shared.Attributes.Sample(
        name: "Custom dictionary style",
        category: "Symbology",
        description: "Use a custom dictionary style (.stylx) to symbolize features using a variety of attribute values.",
        instructions: "Pan and zoom the map to see the symbology from the custom dictionary style.",
        tags: new[] { "dictionary", "military", "renderer", "style", "stylx", "unique value", "visualization", "Featured" })]
    [ArcGISRuntime.Samples.Shared.Attributes.OfflineData("751138a2e0844e06853522d54103222a")]
    public partial class CustomDictionaryStyle
    {
        // Path for the restaurants style file.
        private readonly string _stylxPath = DataManager.GetDataFolder("751138a2e0844e06853522d54103222a", "Restaurant.stylx");

        // Uri for the restaurants feature service.
        private readonly Uri _restaurantUri = new Uri("https://services2.arcgis.com/ZQgQTuoyBrtmoGdP/arcgis/rest/services/Redlands_Restaurants/FeatureServer/0");

        public CustomDictionaryStyle()
        {
            InitializeComponent();
            Initialize();
        }

        private async void Initialize()
        {
            try
            {
                // Create a new map with a streets basemap.
                Map map = new Map(BasemapStyle.ArcGISStreets);

                // Create the restaurants layer and add it to the map.
                FeatureLayer restaurantLayer = new FeatureLayer(_restaurantUri);
                map.OperationalLayers.Add(restaurantLayer);

                // Load the feature table for the restaurants layer.
                await restaurantLayer.FeatureTable.LoadAsync();

                // Open the custom style file.
                DictionarySymbolStyle restaurantStyle = await DictionarySymbolStyle.CreateFromFileAsync(_stylxPath);

                // Create the dictionary renderer with the style file and the field overrides.
                DictionaryRenderer dictRenderer = new DictionaryRenderer(restaurantStyle);

                // Set the restaurant layer renderer to the dictionary renderer.
                restaurantLayer.Renderer = dictRenderer;

                // Set the map's initial extent to that of the restaurants.
                map.InitialViewpoint = new Viewpoint(restaurantLayer.FullExtent);

                // Set the map to the map view.
                MyMapView.Map = map;
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
    }
}
XAML
<UserControl
    x:Class="ArcGISRuntime.WPF.Samples.CustomDictionaryStyle.CustomDictionaryStyle"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:esri="http://schemas.esri.com/arcgis/runtime/2013">
    <esri:MapView x:Name="MyMapView" />
</UserControl>
See Also
Additional Examples
Hyperlink to ExampleDescription
CustomDictionaryStyleUse a custom dictionary style (.stylx) to symbolize features using a variety of attribute values.
DictionaryRendererGraphicsOverlayThis sample demonstrates applying a dictionary renderer to graphics, in order to display military symbology without the need for a feature table.
FeatureLayerDictionaryRendererConvert features into graphics to show them with mil2525d symbols.