How to render a military symbol on the map using SIDC Code

2382
4
05-27-2020 11:57 PM
FuzailSiddiqui
New Contributor III

Hello GeoNet community. I'm working on an application with ECDIS related functionality. I'm getting AIS and radar latitude longitude positions of targets (ships/water crafts etc) and i want to display them in the military symbolic standard MIL STD 2525D. Going through the documentation, i found that we are supposed to use a .stylx file to obtain a symbol however i cannot understand the code to do so. Its also mentioned here (display-military-symbols-with-a-dictionary-renderer) that:

Military symbol dictionary styles allow you to choose whether to assemble and render the symbol based on a single attribute with a unique Symbol ID Code (SIC or SIDC) or based on a series of predefined attributes. For example, in MIL-STD-2525BC2, a SIC of SFSPCL--------- represents this symbol A military symbol based on a symbol ID code..

I cannot find any sample code where i can understand the use of SIDC to obtain a symbol from the .stylx file and display it on the map. Please tell me how do i display a specific symbol using a specific SID Code.

0 Kudos
4 Replies
GayleYoung
Esri Contributor
FuzailSiddiqui
New Contributor III

I'm sorry, it's still not clear, how we pass the SIDC (Symbol Identification Code) or how do we passing some parameters (like modifier, graphic amplifier, text amplifier, frame, icon, fill etc) to the dictionary and get a symbol using this code? There is no code available for that or any reference what are the possible parameters and values.

0 Kudos
FuzailSiddiqui
New Contributor III

Okay so after trying some codes from the incomplete documentations and trying to pass the symbol id attribute using different key names i achieved what i was trying to do. goes like:

  1. Create a DictionarySymbolStyle by passing the mil2525d.stylx file path.
  2. load the dictionary using DictionarySymbolStyle.loadAsync()
  3. Create a HashMap and add a key "sidc" with the value as the 20 digit Symbol Identification Code (SIDC) to the map.
  4. Use the getSymbolAsync() method of the DictionarySymbolStyle class and pass in the map of attributes. This will search and create a symbol from the .stylx file using the code you pass.

My code:

File stylxFile = new File(System.getProperty("user.dir") + "\\mil2525d.stylx");

DictionarySymbolStyle symbolDictionary = DictionarySymbolStyle.createFromFile(stylxFile.getAbsolutePath());

symbolDictionary.loadAsync();

Map<String, Object> attributes = new HashMap<>();

attributes.put("sidc", 10000000000000000000); // pass here a unique 20 digit Symbol ID Code

try {
Symbol s = symbolDictionary.getSymbolAsync(attributes).get();
} catch (InterruptedException e) {
e.printStackTrace();
System.out.println("InterruptedException - failed to symbolize SIDC: "+ sidc);
} catch (ExecutionException e) {
e.printStackTrace();
System.out.println("ExecutionException - failed to symbolize SIDC: "+ sidc);
}

This is how we can create a Symbol using the MIL STD 2525D .stylx file. Now we can create a Graphic object by passing in the symbol and display it on the map.

0 Kudos
GayleYoung
Esri Contributor

Thanks for investigating Fuzail.

Perhaps the Api reference DictionarySymbolStyle (ArcGIS Runtime SDK for Java 100.8.0) was what was missing; it links to the Military Symbology Styles | ArcGIS Solutions for Defense 

Regards,

Gayle.

0 Kudos