style file (.stylx)

2453
3
07-28-2021 04:29 PM
johnmarker
New Contributor III

Hello,

I'm trying to learn more about style files. I'm using the mil2525d.stylx that arcgis provides. In my program, I have a method that gets called when a user right clicks and then clicks on a specific menu bar item. When that item is clicked i want to display one of the graphics from the style sheet. There are a few things that I do not understand and would appreciate any help with.

The first being that I have tried but am unable to see what the style sheet looks like. Since I did not create it I do not know the entirety of its contents. I'm not sure how to open the file and view the different symbols.

Secondly, since I want to display a specific graphic at a specific location I'm unsure how to access the specific symbol that I want (I'm sure this stems back to me not knowing what the file looks like).

Lastly, once I access the symbol I need how do I display that to the map as a graphic. Allowing this to be repeated.

 

Thank you in advance for all and any help.

0 Kudos
3 Replies
PreetiMaske
Esri Contributor

John, mil2525d.stylx is a special dictionary based stylx file that adheres to military specifications and work with data that have associated attributes. There are base symbols for specific attributes but essentially what symbol is used by a feature is assembled based on attributes in data and all this logic is driven by the arcade script backing the stylx. All this happens internally when you map the attributes based on the dictionary stylx being used.
Here is some links from ArcGIS Pro front on :

Mobile style fileshttps://pro.arcgis.com/en/pro-app/latest/help/projects/styles.htm ( see Web styles and Mobile styles sections particulary)

Dictionary symbolshttps://pro.arcgis.com/en/pro-app/2.7/help/mapping/layer-properties/dictionary-renderer.htm
and here are few .Net Samples that showcase use of mil2525d and a custom dictionary in a Runtime application
https://developers.arcgis.com/net/uwp/sample-code/graphics-overlay-dictionary-renderer/
https://developers.arcgis.com/net/uwp/sample-code/custom-dictionary-style/

In your workflow what you need is a simple mobile style file (a local .stylx or published on web referred as webstyles). Mobile style are stylx files capable of working in runtime apps. They are just a collection of vector symbols from ArcGIS Pro. Once created these symbols can be looked up by searching key/category/name etc via a runtime app.

I recommend reading through this topic https://developers.arcgis.com/net/uwp/sample-code/read-symbols-from-mobile-style/. Create a mobile style using symbols you want to use in similar way and look for symbol you want to use to render your graphic.

Hope this helps.
- Preeti

Preeti

0 Kudos
johnmarker
New Contributor III

@PreetiMaske Thank you for the information. I have read through the links that you provided and think im still a little confused. A simplified idea of what I'm wanting to do is that i have a map and if i were to click on that map then it would call a method and add one of those mil2525d symbols to that point of the map. To do this would I use the dictionary renderer? Cause to me it seemed that the dictionary renderer already contained the data of what symbols would be used and where they go on the map. My desktop app needs to be more dynamic. Allowing individual symbols to be displayed and removed during runtime.

0 Kudos
PreetiMaske
Esri Contributor

John, again as I mentioned mil2525d is a dictionary style that creates symbols and assembles a symbol at runtime based on different attributes in the data. Your data needs to be aligned with the specs otherwise it may render the correct symbols from dictionary renderer.

If I understand correctly, you could achieve the workflow of tapping the map and adding symbol without stylx as well but if you may use a simple stylx file if you are really wanting to use advanced symbols from Pro.
Here is a devsummit video link that touched some of the advance symbology stuff. You can skip to 47:02 hrs to get to the topic.

https://www.youtube.com/watch?v=m6ZR1DuYlrQ&list=PLaPDDLTCmy4Ys8vfmC7DbX3FHSsyosvh7&index=29

Another resource that might help understand this would be Symbol editor sample 
https://github.com/Esri/arcgis-runtime-demos-dotnet/tree/main/src/SymbolEditor

0 Kudos