Bug report #21947

Heatmap(KDE) overflow error on filtered posgis point layer

Added by Anthony Foster 7 months ago. Updated 7 months ago.

Status:Feedback
Priority:Normal
Assignee:-
Category:Processing/QGIS
Affected QGIS version:3.4.5 Regression?:No
Operating System:windows 10 Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:29762

Description

Hi,
I am using QGIS 3.4.5 and attempting to creat a heatmap using the Heatmap(KDE) function built into this release. My data is stored in Postgres, has point geometry (srid 27700) and displays fully when the layer is added to qgis via postgis. I can create a heatmap using this layer without issue. However if I apply a filter to the layer (inside QGIS not postgres) the heatmap function will not open and displays the following stack trace;

OverflowError: cannot convert float infinity to integer
Traceback (most recent call last):
File "C:/PROGRA~1/QGIS3~1.4/apps/qgis-ltr/./python/plugins\processing\gui\ProcessingToolbox.py", line 247, in executeAlgorithm
dlg = AlgorithmDialog(alg, self.in_place_mode, iface.mainWindow())
File "C:/PROGRA~1/QGIS3~1.4/apps/qgis-ltr/./python/plugins\processing\gui\AlgorithmDialog.py", line 80, in init
self.setMainWidget(self.getParametersPanel(alg, self))
File "C:/PROGRA~1/QGIS3~1.4/apps/qgis-ltr/./python/plugins\processing\gui\AlgorithmDialog.py", line 96, in getParametersPanel
return ParametersPanel(parent, alg, self.in_place)
File "C:/PROGRA~1/QGIS3~1.4/apps/qgis-ltr/./python/plugins\processing\gui\ParametersPanel.py", line 104, in init
self.initWidgets()
File "C:/PROGRA~1/QGIS3~1.4/apps/qgis-ltr/./python/plugins\processing\gui\ParametersPanel.py", line 243, in initWidgets
wrapper.postInitialize(list(self.wrappers.values()))
File "C:/PROGRA~1/QGIS3~1.4/apps/qgis-ltr/./python/plugins\processing\algs\qgis\ui\HeatmapWidgets.py", line 185, in postInitialize
self.setSource(wrapper.parameterValue())
File "C:/PROGRA~1/QGIS3~1.4/apps/qgis-ltr/./python/plugins\processing\algs\qgis\ui\HeatmapWidgets.py", line 199, in setSource
self.widget.setSource(source)
File "C:/PROGRA~1/QGIS3~1.4/apps/qgis-ltr/./python/plugins\processing\algs\qgis\ui\HeatmapWidgets.py", line 77, in setSource
self.recalculate_bounds()
File "C:/PROGRA~1/QGIS3~1.4/apps/qgis-ltr/./python/plugins\processing\algs\qgis\ui\HeatmapWidgets.py", line 98, in recalculate_bounds
self.pixelSizeChanged()
File "C:/PROGRA~1/QGIS3~1.4/apps/qgis-ltr/./python/plugins\processing\algs\qgis\ui\HeatmapWidgets.py", line 107, in pixelSizeChanged
rows = max(round(self.raster_bounds.height() / cell_size) + 1, 1)
OverflowError: cannot convert float infinity to integer

Python version: 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:59:51) [MSC v.1914 64 bit (AMD64)]
QGIS version: 3.4.5-Madeira Madeira, 89ee6f6e23

Python Path:
C:/PROGRA~1/QGIS3~1.4/apps/qgis-ltr/./python
C:/Users/AT100447/AppData/Roaming/QGIS/QGIS3\profiles\default/python
C:/Users/AT100447/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins
C:/PROGRA~1/QGIS3~1.4/apps/qgis-ltr/./python/plugins
C:\Program Files\QGIS 3.4\bin\python37.zip
C:\PROGRA~1\QGIS3~1.4\apps\Python37\DLLs
C:\PROGRA~1\QGIS3~1.4\apps\Python37\lib
C:\Program Files\QGIS 3.4\bin
C:\PROGRA~1\QGIS3~1.4\apps\Python37
C:\PROGRA~1\QGIS3~1.4\apps\Python37\lib\site-packages
C:\PROGRA~1\QGIS3~1.4\apps\Python37\lib\site-packages\win32
C:\PROGRA~1\QGIS3~1.4\apps\Python37\lib\site-packages\win32\lib
C:\PROGRA~1\QGIS3~1.4\apps\Python37\lib\site-packages\Pythonwin
C:/Users/AT100447/AppData/Roaming/QGIS/QGIS3\profiles\default/python
C:\Users\AT100447\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\mmqgis/forms
C:\Users\AT100447\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins

In my postgres dataset I have four variables;

postcode (character varying)
year (integer) - I have tried changing this data type to numeric and double precision but the issue did not change
date (timestamp without time zone)
geometry (point, 27700)

I have run this same procedure using data stored in 4326 and project crs as 3856 and it worked without issue. The issue occurs when data is stored as 27700 and project CRS is 27700.

History

#1 Updated by Saber Razmjooei 7 months ago

  • Category changed from Rasters to Processing/Core

#2 Updated by Saber Razmjooei 7 months ago

  • Status changed from Open to Feedback

Please update to 3.4.7 and report back. I can't reproduce the issue.

#3 Updated by Giovanni Manghi 7 months ago

Also cannot replicate on 3.6.2 on Linux.

#4 Updated by Anthony Foster 7 months ago

Saber Razmjooei wrote:

Please update to 3.4.7 and report back. I can't reproduce the issue.

Hi Saber,

I've updated and re-run. This is the stack;

OverflowError: cannot convert float infinity to integer
Traceback (most recent call last):
File "C:/PROGRA~1/QGIS3~1.4/apps/qgis-ltr/./python/plugins\processing\gui\ProcessingToolbox.py", line 247, in executeAlgorithm
return
File "C:/PROGRA~1/QGIS3~1.4/apps/qgis-ltr/./python/plugins\processing\gui\AlgorithmDialog.py", line 80, in init
File "C:/PROGRA~1/QGIS3~1.4/apps/qgis-ltr/./python/plugins\processing\gui\AlgorithmDialog.py", line 96, in getParametersPanel
File "C:/PROGRA~1/QGIS3~1.4/apps/qgis-ltr/./python/plugins\processing\gui\ParametersPanel.py", line 104, in init
self.initWidgets()
File "C:/PROGRA~1/QGIS3~1.4/apps/qgis-ltr/./python/plugins\processing\gui\ParametersPanel.py", line 243, in initWidgets
wrapper.postInitialize(list(self.wrappers.values()))
File "C:/PROGRA~1/QGIS3~1.4/apps/qgis-ltr/./python/plugins\processing\algs\qgis\ui\HeatmapWidgets.py", line 185, in postInitialize
self.setSource(wrapper.parameterValue())
File "C:/PROGRA~1/QGIS3~1.4/apps/qgis-ltr/./python/plugins\processing\algs\qgis\ui\HeatmapWidgets.py", line 199, in setSource
self.widget.setSource(source)
File "C:/PROGRA~1/QGIS3~1.4/apps/qgis-ltr/./python/plugins\processing\algs\qgis\ui\HeatmapWidgets.py", line 77, in setSource
self.recalculate_bounds()
File "C:/PROGRA~1/QGIS3~1.4/apps/qgis-ltr/./python/plugins\processing\algs\qgis\ui\HeatmapWidgets.py", line 98, in recalculate_bounds
self.pixelSizeChanged()
File "C:/PROGRA~1/QGIS3~1.4/apps/qgis-ltr/./python/plugins\processing\algs\qgis\ui\HeatmapWidgets.py", line 107, in pixelSizeChanged
rows = max(round(self.raster_bounds.height() / cell_size) + 1, 1)
OverflowError: cannot convert float infinity to integer

Python version: 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:59:51) [MSC v.1914 64 bit (AMD64)]
QGIS version: 3.4.5-Madeira Madeira, 89ee6f6e23

Python Path:
C:/PROGRA~1/QGIS3~1.4/apps/qgis-ltr/./python
C:/Users/AT100447/AppData/Roaming/QGIS/QGIS3\profiles\default/python
C:/Users/AT100447/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins
C:/PROGRA~1/QGIS3~1.4/apps/qgis-ltr/./python/plugins
C:\Program Files\QGIS 3.4\bin\python37.zip
C:\PROGRA~1\QGIS3~1.4\apps\Python37\DLLs
C:\PROGRA~1\QGIS3~1.4\apps\Python37\lib
C:\Program Files\QGIS 3.4\bin
C:\PROGRA~1\QGIS3~1.4\apps\Python37
C:\PROGRA~1\QGIS3~1.4\apps\Python37\lib\site-packages
C:\PROGRA~1\QGIS3~1.4\apps\Python37\lib\site-packages\win32
C:\PROGRA~1\QGIS3~1.4\apps\Python37\lib\site-packages\win32\lib
C:\PROGRA~1\QGIS3~1.4\apps\Python37\lib\site-packages\Pythonwin
C:/Users/AT100447/AppData/Roaming/QGIS/QGIS3\profiles\default/python
C:\Users\AT100447\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\mmqgis/forms
C:\Users\AT100447\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins
.

It's worth noting that I can successfully run the heatmap function based on filtered data that is stored in SRID 4326. The issue occurs if I use 27700 - point layer and project have CRS set to 27700.

Thanks

#5 Updated by Saber Razmjooei 7 months ago

I am using a PostGIS layer in 27700.

Are you sure you are using correct cell size/no. of rows/columns?

#6 Updated by Anthony Foster 7 months ago

Saber Razmjooei wrote:

I am using a PostGIS layer in 27700.

Are you sure you are using correct cell size/no. of rows/columns?

The plugin doesn't open - If I click on the heatmap in the toolbox I immediately get a yellow warning at the top of the workspace and the above stack trace. Could this be because I have a version of python installed as well as qgis?

#7 Updated by Giovanni Manghi 7 months ago

  • Category changed from Processing/Core to Processing/QGIS

The plugin doesn't open - If I click on the heatmap in the toolbox I immediately get a yellow warning at the top of the workspace and the above stack trace. Could this be because I have a version of python installed as well as qgis?

please post/attach a sample of the data it is causing this issue to you.

Also available in: Atom PDF