Starting point: You have data stored in a vector point data layer with attributes attached to each point, however, the points are overlapping.
For this tutorial I used QGIS 2.12.3 Lyon, Ubuntu.
Task: A heatmap would be a solution, however, you want to count the overlapping points in a defined raster in order to make the map more clear and to be able to do further analysis of the data. In other words, you want to realise a point clustering.
If you want to make comparisons among specific attributes, please refer to the optional step at the end of this tutorial.
1 First step: Create a vector grid as base for our analysis
Choose Vector -> Research Tools -> Vector Grid
Depending on your project settings and your specific aim you may choose different parameters here. In my case I the took the extend of my point layer and set the grid distance to 0,001.
You should get something like this (I set the grid transparency to 50%):
2 Second step: Count the points with the polygon grid
Now choose Vector -> Analysis Tools -> Points in Polygons
The tool will count the points in each polygon raster cell and it will aggregate the attributes attached to the points. You can choose various attributes that will be aggregated to the new shape layer. Unfortunately you can only choose very basic statistics to aggregate the data, e.g. the mean value.
If you click OK, you will get another grid of polygons (I called it pointcount9, however, this time the polygons contain the aggregated information of the points. If you label the polygons with the field PNTCNT You should get something like this (Layer properties -> Label -> Label with):
3 Third step: Convert the polygons to points (centroids)
To display the data as a point cluster, you have to create/convert the polygon centers as a new points layer.
Choose Vector -> Geometry Tools -> Polygon centroids
Please remember to select the last generated polygon layer (pointcount). I called the layer centroids.
You will get this:
4 Forth step: Display the centroids layer as a cluster map
The layer generated in the last stepcontains all the attributes of the pointcount layer. We can use this attributes to make the map more understandable.
- First hide all the other layers except the basemap and the centroids layer.
- Next is to label the points with the PNTCNT (pointcount) attribute. This will display the quantity of points (from the original dataset). Please set the PLACEMENT of the labels to offset from point. Alternatively you could label the mean values of the attributes of the point cloud.
- Then set the size of the points in relation to the PNTCNT attribute. You have to go to Layer properties -> Style -> Then click the small € symbol next to Size and choose Size assistant. Set to “Flannery” will avoid that the circles are perceived as to big in relation to the count:
Finally you get something like this:
Optional step (would be the first step): Split the dataset
If you want to compare the dataset in such a cluster map based on a specific attribute, you have to first “split” the dataset.
Choose Vector -> Data Management Tools -> Split vector layer
The attribute you select as the Unique ID field will be the attribute among which the layer will be splitted. In my case the result are three diferent shape files. Each one containing only the points that have the “farbcode” of 1, 2 or 3.
Now add the (three) layers by choosing Layer -> add Layer -> Vector layer
If you want to compare the layers as a cluster point map, you have to repeat step 2–4 for each of the three created layers.