Do map styles need CASE queries?

While working on a map of Tompkins County, I considered creating new fields for calculations using CASE and IF_CASE. It was just extra work. I figured I could create a single text query that is easier to edit that using a graphical interface.

With MAPublisher, I might use the IF_CASE to define fields for styling if the imported data wouldn’t likely change. If I might need to replace the shapefile, then it would be best to calcuate the style directly in the Map Themes palette.

In QGIS, the field calculator doesn’t save the query directly in the Expression Box. Styling is best done in Layer Properties.

CASE is a conditional expression: When condition, then result. Repeat. I’m only documenting these expressions to show how the syntax differs between MAPublisher and QGIS.

Terminology Field Calculator in QGIS is synonymous with Expression Builder in MAPublisher.

In QGIS, the CASE calculation looks like this:

WHEN "2018Score" <12.6 THEN 'Least Suitable'
WHEN "2018Score" >=12.6 AND  "2018Score"<14.1 THEN 'Fair'
WHEN "2018Score" >=14.1 AND  "2018Score"<15.6 THEN 'Good'
WHEN "2018Score" >=15.6 AND  "2018Score"<17.1 THEN 'Very Good'
WHEN "2018Score" >=17.1 THEN 'Excellent'

**Syntax: ** Field name has double quotes. Value has single quotes.

In MAPublisher/Illustrator, it looks like this:

("NULL",2018Score < 12.6, "Least Suitable",
2018Score >= 12.6 AND 2018Score <14.1, "Fair",
2018Score >= 14.1 AND 2018Score <15.6, "Good",
2018Score >= 15.6 AND 2018Score <17.0, "Very good",
2018Score >= 17,"Excellent")

**Syntax: ** Field name has no quotes. Value has double quotes.

For rule based styles, it is faster to compute the style rules directly in the Style sheet.