Categorical Styling
Style features by unique attribute values with automatic color ramps
What Is Categorical Styling?
Categorical styling (also called unique values symbology in ArcGIS and categorized in QGIS) is the cartographic technique of assigning a distinct color or symbol to each unique value of an attribute field. If you have a land-use layer with values like Residential, Commercial, Industrial, and Agricultural, categorical styling gives each category its own color β say green for residential, red for commercial, gray for industrial, yellow for agricultural. The result is a map that tells you at a glance what is where.
Categorical styling is the workhorse of qualitative cartography. It sits alongside graduated styling (quantitative data) as one of the two fundamental data-driven visualization techniques. Use categorical for nominal data (land use, zoning, species, political party) and Graduated Styling for ratio or interval data (income, temperature, population density).
The gis.tools categorical styling tool automates the tedious parts: scanning your attribute field for unique values, assigning colors from a ramp, and letting you override individual colors manually when the automatic assignment does not match your editorial intent.
How Categorical Styling Works
Unique value discovery
The first step is reading the attribute field and finding the set of unique values. For a field like zone_type with 12 different categories across 50,000 features, the tool scans the attribute table once, builds a frequency map, and reports back the 12 distinct values in descending order of count. This is the same operation as SQL's SELECT DISTINCT or pandas' value_counts().
Color ramp assignment
Once the unique values are known, the tool assigns a color from a ColorBrewer qualitative palette (Set1, Set2, Set3, Paired, Pastel1, Dark2, Accent). Qualitative palettes are carefully designed to maximize perceptual distance between adjacent colors so that similar-looking categories are never assigned to similar-looking colors.
For more than 12 categories, the palette wraps or you can switch to a larger qualitative scheme. Very high-cardinality attributes (hundreds of unique values) do not work well for categorical styling β use the Column Statistics tool to check cardinality first.
Rule evaluation
Under the hood, categorical styling produces a set of rules of the form: if attribute equals 'Residential' then fill equals #2ecc71. Each rule is evaluated per feature at render time, which is cheap because attribute lookups are O(1).
Key Parameters and Options
Attribute field
The field to drive the categorization. Typically a string or categorical enum field. Numeric fields with a small number of discrete values (e.g., ward_number 1β7) can also work.
Color ramp
Qualitative palettes are best: Set1 (primary colors, high saturation), Set2 (muted), Set3 (pastel), Paired (pairs of related colors), Dark2 (dark muted). Avoid sequential or diverging palettes for categorical data β they imply an ordering that is not there.
Per-category override
For any individual category, you can override the auto-assigned color. Essential when a category has a natural color (water should be blue, vegetation should be green) that the auto palette missed.
Other / default
Features whose attribute value does not match any defined category fall into the other bucket, usually styled gray or left unstyled.
Stroke and size
Categorical styling affects fill color; strokes, widths, and sizes remain controlled by the underlying Symbology Editor.
Practical Applications
Land use and zoning maps
The canonical use case. Zoning ordinances define a fixed vocabulary of zones (R1, R2, R3, MU, C1, C2, I1, OS). Each needs a recognizable color, often set by municipal standards. Categorical styling with manual color overrides produces a zoning map in minutes rather than hours.
Species distribution
Biologists mapping species observations color each point by species. With 20+ species, automatic palettes wrap, but because species are visually distinguished by position as well as color, slight color repetition is acceptable.
Political and administrative geography
Election results by precinct: red for Republican, blue for Democrat, green for Green, and so on. The classic American election map is a categorical symbology exercise.
Crop type mapping
Agricultural field inventories categorize polygons by crop (corn, soy, wheat, alfalfa, fallow). USDA NASS publishes a standardized palette for crop categorical styling that analysts reuse for consistency across years and projects.
Transportation network classification
Roads classified by functional type (motorway, primary, secondary, residential) use categorical styling to communicate hierarchy. This is how OpenStreetMap renders its road network at every zoom level.
Healthcare facility types
Public health GIS uses categorical styling to distinguish hospitals, clinics, pharmacies, and specialty providers on a service-coverage map. Different symbols plus different colors multiply the perceptual distance.
Step-by-Step Workflow
- Load your data in the Online Map Viewer (Multi-Layer).
- Identify the attribute field to categorize by (check via Column Statistics if unsure).
- Open the categorical styling panel.
- Select the attribute field. The tool scans and lists unique values.
- Pick a color ramp. Set1 or Set2 for fewer than 9 categories; Set3 or Paired for more.
- Review the auto-assigned colors. Override any that conflict with conventions (e.g., water should be blue).
- Configure the other color for unmatched features.
- Apply and preview on the map.
- Generate a legend via the Print Composer.
Worked Example: Mapping Urban Land Use
You have a GeoJSON polygon layer of 15,000 parcels in a mid-sized city with a LU_CODE attribute containing values like R1, R2, R3, C, I, OS, and P. Loading the data shows a gray mass because all parcels render with the default style. Opening categorical styling, you select LU_CODE and the tool scans β 7 unique values, the tool suggests the Set1 palette. You override R1/R2/R3 to shades of yellow (residential tradition), C to red, I to purple, OS to green, P to blue. You hit apply and suddenly the city's zoning pattern becomes instantly legible: a commercial spine along the main street, residential neighborhoods radiating out, industrial clusters along the rail line, and scattered parks. You export with the Print Composer for a community meeting handout.
Common Pitfalls and Gotchas
- Too many categories. Beyond 8β10 distinct colors, the palette wraps and readers cannot distinguish categories. Use Column Statistics to count cardinality before styling.
- Similar-looking colors for different categories. Even qualitative palettes have colors that look alike under poor lighting. Manually override when distinctions matter.
- Missing or null values. Features with null in the categorization field fall into the other bucket or become invisible. Decide intentionally how to handle nulls.
- Field type mismatch. String 1 and integer 1 are different values. Check the data type with Data Profiling Report.
- Trailing whitespace. Attribute values like Residential (with trailing space) and Residential are distinct. Clean your data first.
- Case sensitivity. Commercial and commercial become two categories. Normalize case during preprocessing.
- Unordered legends. Categorical legends do not have an implicit order, so sort them alphabetically or by frequency for readability.
Tips for Best Results
- Normalize your attribute data before categorizing: trim whitespace, lowercase, map synonyms to canonical values.
- Use ColorBrewer qualitative palettes (Set1β3, Dark2, Paired, Pastel1) for maximum perceptual distance.
- Reserve conventional colors where the audience expects them: blue for water, green for vegetation, red for alerts.
- Order the legend by meaning or frequency, not by accidental alphabetical order.
- Verify with colorblind simulators β red/green is the classic trap; use palettes with blue/orange instead.
- Limit categories to 8β10 for readability. Aggregate the tail into other or miscellaneous.
Comparison with Desktop GIS
QGIS's Categorized renderer and ArcGIS Pro's Unique Values symbology do the same thing. Both offer more advanced features: rule-based renderers that combine categorical with graduated, multi-field categorization, symbol replacement with custom SVG per category, and per-category label rules. The gis.tools approach is simpler but covers the core cases with zero installation.
For print-quality cartography with dozens of custom symbols and complex rule hierarchies, QGIS is the right tool. For in-browser iteration and rapid prototyping, the gis.tools categorical styling is unbeatable.
Performance Considerations
Categorical styling scales linearly with feature count because the attribute scan visits every feature once. On a 100,000-feature dataset, the scan completes in a few hundred milliseconds. Rendering performance after styling is the same as any WebGL layer β smooth up to a few hundred thousand features per layer.
Data Privacy and Browser-Based Processing
All processing is local. The attribute scan, unique value discovery, color assignment, and rule evaluation happen entirely in your browser. No data is transmitted anywhere.
Related GIS Concepts
Nominal vs ordinal data. Nominal data (species, zoning) has no natural order; ordinal data (small/medium/large) has a rank ordering. Categorical styling ignores any ordering; for ordinal data, a graduated scheme with a sequential color ramp is often more appropriate.
Cardinality. The number of unique values in a field. High-cardinality fields are poor candidates for categorical styling.
ColorBrewer. A research-backed color palette catalog maintained by Cindy Brewer at Penn State. The de facto standard for cartographic color choice.
Symbol layers. Cartographic tradition distinguishes fill, stroke, and pattern as separate symbol layers that can be independently varied by category.
Frequently Asked Questions
How many categories can I display at once?
Technically unlimited, but visual distinguishability caps out around 8β12 categories. Above that, aggregate or switch to small-multiples.
Can I use a categorical palette on numeric data?
If the numeric field has a small number of discrete values (e.g., ward number, cluster ID) β yes. For continuous numeric data, use Graduated Styling.
What if my categories are messy (whitespace, case)?
Clean them first using Data Profiling Report to find duplicates, then preprocess before loading.
How do I match a specific palette required by a client?
Override each category's color manually using the color picker in the styling panel.
Related Tools on gis.tools
Related Tools
View All ToolsLabel Placement Tool
Configure label collision detection and priority settings
Map ViewingLayer Styler
Adjust opacity, stroke width, colors, and dashed lines
Map ViewingHeatmap Renderer
Render point data as a smooth heatmap visualization
Map ViewingBasemap Switcher
Switch between different basemap styles including offline options
Map ViewingSymbology Editor
Edit feature colors, sizes, strokes, and labels
Map ViewingScale Bar & North Arrow
Add scale bar, north arrow, and graticule to your map
Map Viewing100% client-side processing - your data stays private and never leaves your device