Dictionary renderer with feature layer

View inMAUIUWPWPFWinUIView on GitHub

Convert features into graphics to show them with mil2525d symbols.

Image of dictionary renderer with feature layer

Use case

A dictionary renderer uses a style file along with a rule engine to display advanced symbology. This is useful for displaying features using precise military symbology.

How to use the sample

Pan and zoom around the map. Observe the displayed military symbology on the map.

How it works

  1. Create a Geodatabase using Geodatabase(geodatabasePath).
  2. Load the geodatabase asynchronously using Geodatabase.LoadAsync().
  3. Instantiate a SymbolDicitonary using SymbolDictionary(specificationType).
    • specificationType will be the mil2525d.stylx file.
  4. Load the symbol dictionary asynchronously using DictionarySymbol.LoadAsync().
  5. Wait for geodatabase to completely load.
  6. Cycle through each GeodatabaseFeatureTable from the geodatabase using Geodatabase.GeodatabaseFeatureTables.
  7. Create a FeatureLayer from each table within the geodatabase using FeatureLayer(GeodatabaseFeatureTable).
  8. Load the feature layer asynchronously with FeatureLayer.LoadAsync().
  9. Wait for each layer to load.
  10. After the last layer has loaded, then create a new Envelope from a union of the extents of all layers.
    • Set the envelope to be the Viewpoint of the map view using MapView.SetViewpoint(new Viewpoint(Envelope)).
  11. Add the feature layer to map using Map.OperationalLayers.Add(FeatureLayer).
  12. Create DictionaryRenderer(SymbolDictionary) and attach to the feature layer.

Relevant API

  • DictionaryRenderer
  • SymbolDictionary

Offline data

This sample downloads the following items from ArcGIS Online automatically:

  • mil2525d.stylx - A stylx file for use with ArcGIS Runtime 100.0 - 100.4 to build custom applications that incorporate the MIL-STD-2525D symbol dictionary.
  • militaryoverlay.geodatabase.zip - This is a mobile geodatabase created from the Military Overlay template for use in ArcGIS Runtime samples

Tags

military, symbol

Sample Code

FeatureLayerDictionaryRenderer.xamlFeatureLayerDictionaryRenderer.xamlFeatureLayerDictionaryRenderer.xaml.cs
Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
<UserControl
    x:Class="ArcGIS.UWP.Samples.FeatureLayerDictionaryRenderer.FeatureLayerDictionaryRenderer"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:esri="using:Esri.ArcGISRuntime"
    xmlns:esriUI="using:Esri.ArcGISRuntime.UI.Controls"
    mc:Ignorable="d"
    d:DesignHeight="300" d:DesignWidth="300">
    <Grid>
        <esriUI:MapView x:Name="MyMapView" />
    </Grid>
</UserControl>

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.