I propose an approach which only recurs to a geometry generator and a custom function.
Firstly, go to
Layer Properties | Style and then choose the
Single symbol renderer.
Symbol selector dialog, choose a
Geometry generator as symbol layer type and
Polygon / MultiPolygon as geometry type. Then, click on the
Function Editor tab:
Then, click on
New file and type
buff_numb as the name of the new function:
You will see that a new function has been created and it is listed on the left side of the dialog. Now, click on the name of the function and replace the default
@qgsfunction with the following code (don't delete the libraries imported by default):
def buff_numb(layer_name, curr_feat, feature, parent):
layer = QgsMapLayerRegistry.instance().mapLayersByName(layer_name)
index = QgsSpatialIndex()
for ft in layer.getFeatures():
tmp_geom = curr_feat.geometry()
idsList = index.intersects(tmp_geom.boundingBox())
Once you have done this, click on the
Load button and you will be able to see the function from the
Custom Menu of the
Now, type this expression (see the image below as a reference):
0.04 * buff_numb(@layer_name, $currentfeature)
You have just run a function which is saying, in an imaginary way:
"For the current layer (@layer_name) and the current feature ($currentfeature), display its geometry using a buffer having a radius of 0.04 decimal degrees times the number of occurrences."
The only thing you need to change is the value of the radius: I expressed it in decimal degrees since you wrote about lat/lon, so I assumed you were using a Geographic Reference System (if not, this is not a problem and you can set any value you want). Therefore, leave the other function parameters as provided.
Finally, click on the
Apply button for applying the changes.
You will see something like this: