You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Use a custom dictionary style (.stylx) to symbolize features using a variety of attribute values.
3
+
Use a custom dictionary style created from a web style or local style file (.stylx) to symbolize features using a variety of attribute values.
4
4
5
5

6
6
@@ -10,27 +10,35 @@ When symbolizing geoelements in your map, you may need to convey several pieces
10
10
11
11
## How to use the sample
12
12
13
-
Pan and zoom the map to see the symbology from the custom dictionary style.
13
+
Use the radio buttons to toggle between the dictionary symbols from the web style and style file. Pan and zoom around the map to see the symbology from the chosen dictionary symbol style. The web style and style file are slightly different to each other to give a visual indication of the switch between the two.
14
14
15
15
## How it works
16
16
17
-
1. Create a new `DictionarySymbolStyle` by passing in the path to the custom style file (.stylx).
18
-
2. Create a new `DictionaryRenderer`, providing the dictionary symbol style.
19
-
3. Apply the dictionary renderer to a feature layer using `layer.setRenderer(dictionaryRenderer)`.
17
+
1. Create a `PortalItem`, referring to a `Portal` and the item ID of the web style.
18
+
2. Based on the style selected:
19
+
* If the web style toggle has been selected, create a new `DictionarySymbolStyle` from the portal item using `new DictionarySymbolStyle(portalItem)`, and load it
20
+
* If the file style toggle has been selected, create a new `DictionarySymbolStyle` using `DictionarySymbolStyle.createFromFile(stylxFile.getAbsolutePath())`
21
+
3. Create a new `DictionaryRenderer`, providing the dictionary symbol style.
22
+
4. Apply the dictionary renderer to a feature layer using `featureLayer.setRenderer(dictionaryRenderer)`.
23
+
5. Add the feature layer to the map's operational layers using `getOperationalLayers().add(featureLayer)`.
20
24
21
25
## Relevant API
22
26
23
27
* DictionaryRenderer
24
28
* DictionarySymbolStyle
29
+
* Portal
30
+
* PortalItem
25
31
26
32
## About the data
27
33
28
-
The data used in this sample is from a feature layer showing a subset of [restaurants in Redlands, CA](https://services2.arcgis.com/ZQgQTuoyBrtmoGdP/arcgis/rest/services/Redlands_Restaurants/FeatureServer) hosted as a feature service with attributes for rating, style, health score, and open hours. The feature layer is symbolized using a dictionary renderer that displays a single symbol for all of these variables. The renderer uses symbols from a custom [restaurant dictionary style](https://arcgisruntime.maps.arcgis.com/home/item.html?id=751138a2e0844e06853522d54103222a), available as an item from ArcGIS Online, to show unique symbols based on several feature attributes. The symbols it contains were created using ArcGIS Pro. The logic used to apply the symbols comes from an Arcade script embedded in the stylx file (which is a SQLite database), along with a JSON string that defines expected attribute names and configuration properties.
34
+
The data used in this sample is from a feature layer showing a subset of [restaurants in Redlands, CA](https://services2.arcgis.com/ZQgQTuoyBrtmoGdP/arcgis/rest/services/Redlands_Restaurants/FeatureServer) hosted as a feature service with attributes for rating, style, health score, and open hours.
35
+
36
+
The feature layer is symbolized using a dictionary renderer that displays a single symbol for all of these variables. The renderer uses symbols from a custom restaurant dictionary style created from a [stylx file](https://arcgis.com/home/item.html?id=751138a2e0844e06853522d54103222a) and a [web style](https://arcgis.com/home/item.html?id=adee951477014ec68d7cf0ea0579c800), available as items from ArcGIS Online, to show unique symbols based on several feature attributes. The symbols it contains were created using ArcGIS Pro. The logic used to apply the symbols comes from an Arcade script embedded in the stylx file (which is a SQLite database), along with a JSON string that defines expected attribute names and configuration properties.
29
37
30
38
## Additional information
31
39
32
40
For information about creating your own custom dictionary style, see the open source [dictionary renderer toolkit](https://esriurl.com/DictionaryToolkit) on *GitHub*.
Copy file name to clipboardExpand all lines: symbology/custom-dictionary-style/README.metadata.json
+9-3Lines changed: 9 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -1,25 +1,31 @@
1
1
{
2
2
"category": "Symbology",
3
-
"description": "Use a custom dictionary style (.stylx) to symbolize features using a variety of attribute values.",
3
+
"description": "Use a custom dictionary style created from a web style or local style file (.stylx) to symbolize features using a variety of attribute values.",
Copy file name to clipboardExpand all lines: symbology/custom-dictionary-style/src/main/java/com/esri/samples/custom_dictionary_style/CustomDictionaryStyleSample.java
0 commit comments