Sunday 29 November 2015

qgis - How to symbolize features with NULL values in graduated symbology?


I have a polygon feature dataset, and an attribute from a different table that I join (one-to-one) within QGIS in order to symbolise the attributes as a choropleth map. However, not all polygon fields have a matching field in the table of numerical attributes, so there are some null values when producing the graduated symbology.


From my research, the most common piece of advice in this situation is to include a copy of the polygon dataset (or some other background) that defines a default symbology. This works because the null values are not classified in the graduated symbology, so one can see "underneath" them. I have attached an image of exactly this. The dark grey features do not exist in the join table (mb_percentile_isochrones_all), but do exist in the boundary polygons table (mb2013_wgtn). So I need two instances of the mb2013_wgtn table in order to show the "no data" features.


enter image description here


However, this does not seem elegant to me. Much more intuitive would be to define a null value symbol. Perhaps this could be perfectly transparent to be consistent with what currently exists, or perhaps it would be some kind of muted grey—whatever the user wants. The point is, at present one needs two different layers in the contents in order to handle the symbology of null values. This means that to change the symbology of all your features at the same time (say, if you want to increase the width of all borders), this has to be handled twice: once in the properties for the feature with the graduated symbology, and once for the "background" layer that handles the null symbol.


Is it possible to define a "null" value symbol without using a "copy" of the same layer used for the graduated symbology, in QGIS (2.6.1)?




Answer



As @MichaelMiles-Stimson already mentioned, there doesn't seem to be a way to symbolise NULL features. However, there is an alternative whereby you create a filter to force QGIS to treat NULL values as an integer such as 0. I've included an example where I created 3 simple polygons each with a certain value:


3 polygons


Attribute table


Here is the Graduated Symbology I used with the following command:


case when "Some_Value" IS NULL then 0 else "Some_Value" end

Graduated symbology


Hope this helps!


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...