Saturday, 5 July 2014

Geometric Classification Method in QGIS

Graduated symbolology for vector layers is largely used in archaeology, e.g. for classifying with different colors, dimensions or symbols excavation grids, survey's squares, site points, etc.
The graduated symbology is built by the “classification” of a numeric variable: for example, if we have an excavation grid of 60 squares that register the weight of finds for each of them, vector layer classification consists of defining the number of weight's classes (e.g. 5), intervals in which data are grouped (0-10 g, 11-20 g, 21-30 g, etc.) and colors or symbols representing each class.
This classification may be different depending on the different mathematical and statistical method applied. Different classification methods yield different results, as you can see in this picture:
In order to using the proper classification method is necessary to know the shape of frequency distribution that the variable we want to classify assumes: for uniform distributions "Equal Interval" or "Pretty Breaks" methods are good; for normal distributions "Standrd Deviation" or "Quantile" methods are better; for bi- or polimodal distributions "Natural Breaks (Jenks)" method is the best choice.

In Archaeology exponential (positive skewed) distributions are frequent. Here you can see an example of exponential distribution of data:

When we deal with an exponential distribution of our data, the proper classification method is "Geometric Intervals" (Dent B. D. 1999, Cartography. Thematic Map Design. Fifth Edition, London, pp. 146; 406. Conolly J., Lake M. 2006, Geographical Information Systems in Archaeology, Cambridge, pp. 141-­145).

As far as I know, GIS FLOSS (QGIS, GRASS, gvSIG, Openjump, Saga, etc.) don't include this classification method. I tried to develop it for QGIS using the opportunities provided by its Console Python.

I developed a simple Python script for geometric classification, using the formula suggested by Dent 1999, p. 146 and with the help of web community, in particular the blog of Carson Farmer ( and a mailing list reply of Kelly Thomas (­to­apply­a­graduated­renderer­in­

You can find more details and download the script from programming section of the site:

Here I would like to post an example of usage step by step:

1. Open in a text editor and modify your variables (field of numeric data to classify and number of classes). Save the modified file.

2. In QGIS load your shapefile, select it and open "CONSOLE PYTHON" from Plugin. In Console type:

###For GNU-Linux:

###FOR Win:

Press ENTER (1) and then UPDATE button in QGIS toolbar (2). Open Vector Style Manager (double click on your vector layer) for viewing legend and changing color ramp (3).

3. The resulting map should look like this:

Remember that my script is under development and in need of improvement and testing: use it without warranties! Test and suggestions are welcome.

That's all. 

Denis Francisci


  1. Howdy, I'd really like to download the python script, but is down. Any advice?

  2. Hi Charlie, I just sent a message to Denis Francisci (the author of this post). As soon as he will answer, I will post some news here


BlogItalia - La directory italiana dei blog Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 International License.