Categorical visualizations
Categorical visualizations use a categorical attribute and the categories within it to apply styling to discrete categories of the attribute. (On raster datasets, categories are raw pixel values instead — see Raster visualizations.)
Categorical visualizations are defined using "type": "categorical" and, for every supported style and label property used, either a single value that will apply to all categories or an array of different values for each category.
You can list the categories explicitly, or use a shortcut when you don't know the exact values: {"type": "top", "count": N} keeps the N most common values (vector), and {"type": "all"} covers every unique pixel value (raster). When showOther: true is combined with an explicit categories array, paint/label arrays need N + 1 values — the extra one styles the "Other" bucket. For colors, prefer a @palette shortcut over a hand-built array.
Example
The Global Power Plants layer in Felt is an example of a categorical layer on a vector dataset

and is defined by the following style
Notice that we are saying that the primary_fuel data attribute will be used to categorize elements and that the possible values of that attribute that we are interested in are "Solar", "Hydro", "Wind", "Gas", "Coal", "Oil" and "Nuclear" (colors are assigned in the same order). Also notice that we are defining either a single value that will apply to all categories (i.e. size) or a value for each category (i.e. color)
More patterns
Palette shortcut + "top N". When you don't know the exact category values, let Felt pick the most common ones and color them from a categorical palette:
A different icon per category. iconImage and the paint arrays follow the same N (or N + 1 with showOther) pattern as color:
Styling "Other" separately. With showOther: true, the trailing array element targets the "Other" bucket — here it is made smaller and more transparent than the named categories:
Last updated
Was this helpful?