Skip to content

Commit 7aa0dd5

Browse files
committed
Small fixes to heatmap plugin
Update context help for heatmap
1 parent 9e5b889 commit 7aa0dd5

File tree

3 files changed

+45
-17
lines changed

3 files changed

+45
-17
lines changed

resources/context_help/HeatmapGui-en_US

Lines changed: 32 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,52 @@
11
<h1>Heatmap Plugin Help</h1>
2-
<p>The Heatmap plugin uses Kernel Density Estimation to create a density (heatmap) raster of an input point vector layer. The density is calculated based on the number of points in a location, with larger numbers of clustered points resulting in a larger raster values.</p>
2+
<p>The Heatmap plugin uses Kernel Density Estimation to create a density (heatmap)
3+
raster of an input point vector layer. The density is calculated based on the
4+
number of points in a location, with larger numbers of clustered points resulting
5+
in larger values. Heatmaps allow easy identification of "hotspots" and
6+
clustering of points.</p>
37

48
<h2>Dialog Parameters</h2>
59

6-
<h3>Input Point Vector</h3>
10+
<h3>Input point layer</h3>
711
<p>The input is always a vector layer of point type. All the point vector layers that are currently loaded in the canvas are shown in the drop-down list. Click the dropdown button and select the desired layer.</p>
812

9-
<h3>Output Raster</h3>
13+
<h3>Output raster</h3>
1014
<p>The output raster location and filename can be set by clicking the <label>...</label> button next to the output raster textbox.<br/>
1115
<b>Note:</b> The file format is automatically added depending upon the output format selected, if not explicitly given.</p>
1216

13-
<h3>Output Format</h3>
17+
<h3>Output format</h3>
1418
<p>All the file creation supporting GDAL formats are available in the drop down list. Click and select the required output format for your file.<br/>
15-
<b>Note:</b> GeoTiff and ERDAS Imagine .img formats are recommended. Some formats make the application crash. Kindly stick to the recommended formats until the crash issue is resolved or use an other formats if you know GDAL supports it completely.</p>
19+
<b>Note:</b> GeoTiff and ERDAS Imagine .img formats are recommended. Some formats make the application crash. Kindly stick to the recommended formats until the crash issue is resolved or use other formats if you know GDAL supports it completely.</p>
1620

17-
<h3>Heatmap Point Attributes</h3>
18-
<h4>Radius (bandwidth)</h4>
19-
<p>The buffer radius specifies the distance around a point at which the influence of the point will be felt. Larger values result in greater smoothing, but smaller values may show finer details.</p>
21+
<h3>Radius (bandwidth)</h3>
22+
<p>Used to specify the heatmap search radius (or kernel bandwidth) in meters or map units. The radius specifies the distance around a point at which the influence
23+
of the point will be felt. Larger values result in greater smoothing, but smaller values may show finer details and variation in point density.</p>
2024

25+
<h3>Advanced Options</h3>
26+
27+
<h4>Rows and Columns</h4>
28+
<p>Used to change the dimensions of the output raster file. These values are also linked to the <b>Cell size X</b> and <b>Cell size Y</b> values.
29+
Increasing the number of rows or colums will decrease the cell size and increase the file size of the output file. The values in Rows and Columns
30+
are also linked, so doubling the number of rows will automatically double the number of columns and the cell sizes will also be halved. The geographical area of the output raster will remain the same!</p>
31+
32+
<h4>Cell size X and Y</h4>
33+
<p>Control the geographic size of each pixel in the output raster. Changing these values will also change the number of Rows and Columns in the output
34+
raster.</p>
35+
2136
<h4>Kernel shape</h4>
22-
<p>The kernel shape parameter controls the rate at which the influence of a point decreases as the distance from the point increases. A number of standard kernel functions are available, which are described in detail on <a href="http://en.wikipedia.org/wiki/Kernel_(statistics)#Kernel_functions_in_common_use">Wikipedia</a>.
23-
</p>
37+
<p>The kernel shape controls the rate at which the influence of a point decreases as the distance from the point increases. Different kernels decay at
38+
different rates, so a triweight kernel gives features greater weight for distances closer to the point then the Epanechnikov kernel does. Consequently,
39+
triweight results in "sharper" hotspots, and Epanechnikov results in "smoother" hotspots. A number of standard kernel functions are available in QGIS,
40+
which are described and illustrated on <a href="http://en.wikipedia.org/wiki/Kernel_(statistics)#Kernel_functions_in_common_use">Wikipedia</a>.</p>
41+
42+
<h4>Decay ratio</h4>
43+
<p>For triangular kernels, the decay ratio defines amount of influence that applies to the outermost pixels in the buffer radius. A value of 0 reflects a standard triangular kernel, where the influences drops to zero as the distance from the pixel to the point approaches the specified radius. In contrast, a value of 1 indicates that no falloff occurs as the distance from the point increases.</p>
44+
2445
<h4>Use radius from field</h4>
2546
<p>Optionally, the value in a specified field can be used to control the kernel radius for each point in the input layer.</p>
47+
2648
<h4>Use weight from field</h4>
2749
<p>Optionally, a attribute containing weights for points can be used to weight some points in the input layer more than others.</p>
28-
<h4>Decay ratio</h4>
29-
<p>For triangular kernels, the decay ratio defines amount of influence that applies to the outermost pixels in the buffer radius. A value of 0 reflects a standard triangular kernel, where the influences drops to zero as the distance from the pixel to the point approaches the specified radius. In contrast, a value of 1 indicates that no falloff occurs as the distance from the point increases.</p>
3050

3151
<h2>Further Details</h2>
3252
<p>Contact the author through aruntheguy at gmail dot com</p>

src/plugins/heatmap/heatmap.cpp

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -412,10 +412,18 @@ double Heatmap::triangularKernel( double distance, int bandwidth )
412412
// Normalizing constant. In this case it's calculated a little different
413413
// due to the inclusion of the non-standard "decay" parameter
414414

415-
double k = 3. / (( 1. + 2. * mDecay ) * M_PI * pow(( double )bandwidth, 2 ) );
415+
if ( mDecay >= 0 )
416+
{
417+
double k = 3. / (( 1. + 2. * mDecay ) * M_PI * pow(( double )bandwidth, 2 ) );
416418

417-
// Derived from Wand and Jones (1995), p. 175 (with addition of decay parameter)
418-
return k * ( 1. - ( 1. - mDecay ) * ( distance / ( double )bandwidth ) );
419+
// Derived from Wand and Jones (1995), p. 175 (with addition of decay parameter)
420+
return k * ( 1. - ( 1. - mDecay ) * ( distance / ( double )bandwidth ) );
421+
}
422+
else
423+
{
424+
// Non-standard or mathematically valid negative decay ("coolmap")
425+
return ( 1. - ( 1. - mDecay ) * ( distance / ( double )bandwidth ) );
426+
}
419427
}
420428

421429
// Unload the plugin by cleaning up the GUI

src/plugins/heatmap/heatmapguibase.ui

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@
127127
<item row="0" column="0">
128128
<widget class="QLabel" name="rowLabel">
129129
<property name="text">
130-
<string>Row</string>
130+
<string>Rows</string>
131131
</property>
132132
<property name="buddy">
133133
<cstring>rowLineEdit</cstring>
@@ -147,7 +147,7 @@
147147
<item row="0" column="2">
148148
<widget class="QLabel" name="columnLabel">
149149
<property name="text">
150-
<string>Column</string>
150+
<string>Columns</string>
151151
</property>
152152
<property name="buddy">
153153
<cstring>columnLineEdit</cstring>

0 commit comments

Comments
 (0)