ArcGIS Runtime SDK for Java

Display military symbols with a dictionary renderer

Starting at 100.0.0, you can display military symbols by using a dictionary renderer with either a feature layer or graphics overlay.

  • Use a feature layer when you want to display data from a feature service or from a mobile geodatabase via a feature table. A feature layer has an associated feature table that has a predefined schema that cannot be modified.
  • Use a graphics overlay for more transient data, such as military messages coming through a web socket. A graphics overlay contains graphics, which have attributes you can set and modify.

For more information on whether to use feature layers or graphics overlays for your scenario, see Features and graphics.

When you display military symbols, you associate a dictionary symbol style (DictionarySymbolStyle) to a dictionary renderer (DictionaryRenderer), then associate the dictionary renderer to the layer or overlay where you want to display the symbols. The dictionary symbol style contains the symbols and the dictionary renderer displays them.

Display military symbols with a feature layer

The main steps you perform when displaying military symbols using a feature layer are to create a dictionary symbol style, associate it with a dictionary renderer, then apply that renderer to the feature layer. Each feature layer has an underlying feature table with individual feature records in it. Each feature in the table has a geometry field and one or more attribute fields that provide information that determines which symbol to use for that feature.

To display symbols

  1. Create a dictionary symbol style.
  2. Create a layer and set the feature table. Create a dictionary renderer by passing in the dictionary symbol style. If your data contains field names that don't match the fields in the military specification you're using, map the field names in your data to the specification fields. Then apply the renderer to the feature layer.

    Geodatabase geodatabase = new Geodatabase("path/to/dictionary/geodatbase");
    geodatabase.loadAsync();
    // render tells layer what symbols to apply to what features
    DictionarySymbolStyle symbolDictionary = new DictionarySymbolStyle("specificationType");
    symbolDictionary.loadAsync();
    
    
    geodatabase.addDoneLoadingListener(() -> {
      geodatabase.getGeodatabaseFeatureTables().forEach(table -> {
        // add each layer to map
        FeatureLayer featureLayer = new FeatureLayer(table);
        featureLayer.loadAsync();
    
    
        // displays features from layer using mil2525d symbols
        DictionaryRenderer dictionaryRenderer = new DictionaryRenderer(symbolDictionary);
        featureLayer.setRenderer(dictionaryRenderer);
      });
    });

To see this snippet in the context of a full code sample, see Feature layer dictionary renderer sample.

Display military symbols with a graphics overlay

The main steps you perform when displaying military symbols using a graphics overlay are to create a dictionary symbol style, associate it with a dictionary renderer, then apply that renderer to the graphics overlay.

  1. Create a dictionary symbol style.
  2. Create a graphics overlay. Create a dictionary renderer by passing in the dictionary symbol style. If your data contains field names that don't match the fields in the military specification you're using, map the field names in your data to the specification fields. Then apply the renderer to the graphics overlay.

    // create symbol dictionary from specification
    DictionarySymbolStyle symbolDictionary = new DictionarySymbolStyle("specificationType");
    
    
    // tells graphics overlay how to render graphics with symbol dictionary attributes set
    DictionaryRenderer renderer = new DictionaryRenderer(symbolDictionary);
    graphicsOverlay.setRenderer(renderer);

To see this snippet in the context of a full code sample, see Graphics overlay dictionary renderer sample.

Create a dictionary symbol style

To display military symbols, you associate the layer/overlay's dictionary renderer to a dictionary symbol style. A dictionary symbol style is composed of:

  • A style file—A .stylx file you can create in ArcGIS Pro that contains symbol primitives such as the symbol frame, the lines that make up inner icons, and so on.
  • A rule engine—A tool that assembles military symbols using data in the style file and rules from the military standard you specify.

The ArcGIS for Defense team hosts .stylx files on ArcGIS Online. These files contain the data that the dictionary renderer uses to display military standard symbology in custom native applications using the ArcGIS Runtime SDKs. See the Military Symbology Styles page for more information and to download the files.

To create a dictionary symbol style

  1. Specify the military specification you want to use.
  2. Specify the path to the .stylx file.

    DictionarySymbolStyle dictionarySymbol =
      new DictionarySymbolStyle("specificationType", "absolute/path/to/file.stylx");
    dictionarySymbol.loadAsync();

  3. Tip:
    At time of publishing, the supported specifications are MIL-STD-2525B (change 2), MIL-STD-2525C, and MIL-STD-2525D, but you can also list the supported specifications by using the specificationTypes static function on the dictionary symbol style.

Map data fields to specification fields

The dictionary renderer will automatically read fields in your data that have names matching those required by the military specification. For any field names in your data that don't exactly match the field names provided in the military specification you want to use, map the field names by calling symbologyFieldOverides and textFieldOverrides on the dictionary renderer. These operations take in a set of key value pairs, where the key is the specification’s attribute name (for example, symbolset), and the value is your data's corresponding attribute name (for example, symbol_set).

If you're not sure if your fields match, you can obtain a string list of a given standard’s expected symbology and text fields by calling symbologyFieldNames and textFieldNames.

Military symbols

Military symbols are based on military specifications (military standards, such as MIL-STD-2525C and MIL-STD-2525D) and are made up of many elements such as frames, icons, modifiers, graphic amplifiers, and text amplifiers. In ArcGIS, military symbols are made up of multiple symbol layers.

Each military specification determines what values must be provided to assemble and render the symbol. In the case of MIL-STD-2525D, the symbols are based on a series of predefined attributes (such as identity, symbolset, and so on), each having a range of valid values associated with it. Other specifications may use only one attribute, but the one attribute value is made up of a code, such as a 15-character Symbol ID code (known as SIC or SIDC) that defines how the symbol should look. For example, in MIL-STD2525C, a SIC of GFGPOAP---****X represents this symbol . Regardless of the specification, all military symbols are based on a varying combination of attributes or codes and a set of rules about how the symbols should display.

A map in an ArcGIS Runtime app showing military symbols