[Qgis-user] More QGIS Density Analysis Updates and Some Time Comparisons

C Hamilton adenaculture at gmail.com
Thu Aug 18 13:03:10 PDT 2022


Anyone dealing with heatmaps or density estimation will be interested in
this plugin.

https://plugins.qgis.org/plugins/densityanalysis/

QGIS natively has the Heatmap (Kernel Density Estimation) algorithm
which is powerful and produces a heatmap image that can then be styled and
displayed. Each pixel in the image represents an area with an accumulated
intensity of the density from the input point layer data.

The Density Analysis plugin adds 3 vector gridded density map algorithms.
1) One of these can be done with a series of steps using QGIS algorithms
such as "Create grid" over the point layer extent, followed by "Count
points in polygon", "Extract by attribute", and then style it. The Density
Analysis plugin does this in one step. If the input point layer is not
spatially indexed then the "Count points in polygon" can be painfully slow.

The next algorithm takes the point layer and generates a geohash string for
each coordinate and creates a dictionary of geohash strings with their
counts. These geohashes are then turned into polygons with a NUMPOINTS
count attribute. The third algorithm makes use of the H3 geohash library
(which you must pip install). H3 geohashing produces hexagon boundaries and
is ideal for density analysis and is blazing fast. Here are some time
comparisons on my computer with these three algorithms. I ran this on a
layer containing 193401 points and there are two different grid cell sizes.

Algorithm                     4km grid      1.22 km grid
----------------------------  ------------  -------------
QGIS count points in polygon  8.16 seconds  63.18 seconds
Geohash                       4.89 seconds  5.6 seconds
H3 geohash                    3.56 seconds  3.79 seconds

When the grid gets more dense the time it takes to count points in
polygons really goes up but the geohashing doesn't change much. We tested
the H3 algorithm against the similar capability in ArcGIS. Here are those
results.

Grid Resolution   ArcGIS        QGIS H3 geohash
---------------   ----------    ----------------
400m              50 seconds    2.93 seconds
50m               3:20 minutes  12.51 seconds

The latest Density analysis plugin includes the following updates:
1. Added a settings dialog that allows the user to choose the default color
ramp used in the algorithms. The setting is persistent from one launch of
QGIS to the next.
2. Added  an invert color ramp check box.
3. Added a styled polygon density algorithm.
4. Added a styled heatmap (kernel density estimation) algorithm. This is a
wrapper on the QGIS Heatmap algorithm, but you specify the grid/pixel cell
size in terms of km, m, mi, etc and not in terms of the CRS of the input
layer. It then automatically styles the layer.
5. Added a H3 grid algorithm.

For a more complete list of capabilities install the plugin and select Help
from "Plugins->Density Analysis".

Best wishes to everyone,

Calvin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20220818/47be6475/attachment.htm>


More information about the Qgis-user mailing list