Skip to content

Buffer problem? #91

@Solivetti

Description

@Solivetti

Good morning,
I have used the Hotspot plugin several times with satisfying results. Recently, I tried to use the Hotspot plugin within a QGIS project including many layers and I met with this warning, which pops up as soon as I click on the Hotspot icon, and therefore even before trying to fill the Hotspot window.
The shapefile with grid & count is top of the list. The count field does not contain null cases. QGIS version is 3.28.11. RAM is 32 Giga.
I found that the warning is associated with this specific project. Indeed, I started a new project with only the basic layers of the previous project, saved it and started again QGIS: the problem is over.
I am asking myself however which is the cause of the trouble and whether is it possible to find a solution less “manual”.
2023-10-15T17:47:18 WARNING Traceback (most recent call last):
File "C:\Users\solivetti\AppData\Roaming\Python\Python39\site-packages\pysal\lib\weights\util.py", line 1028, in get_points_array
data = np.vstack([np.array(shape.centroid) for shape in iterable])
File "C:\Users\solivetti\AppData\Roaming\Python\Python39\site-packages\pysal\lib\weights\util.py", line 1028, in
data = np.vstack([np.array(shape.centroid) for shape in iterable])
AttributeError: 'Point' object has no attribute 'centroid'

         During handling of the above exception, another exception occurred:
         
         Traceback (most recent call last):
          File "C:\Users/solivetti/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\HotspotAnalysis\hotspot_analysis.py", line 532, in 
          self.dlg.comboBox.currentIndexChanged.connect(lambda: self.load_comboBox())
          File "C:\Users/solivetti/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\HotspotAnalysis\hotspot_analysis.py", line 473, in load_comboBox
          thresh = pysal.lib.weights.user.min_threshold_dist_from_shapefile(path)
          File "C:\Users\solivetti\AppData\Roaming\Python\Python39\site-packages\pysal\lib\weights\user.py", line 86, in min_threshold_dist_from_shapefile
          points = get_points_array_from_shapefile(shapefile)
          File "C:\Users\solivetti\AppData\Roaming\Python\Python39\site-packages\pysal\lib\weights\util.py", line 1077, in get_points_array_from_shapefile
          data = get_points_array(f)
          File "C:\Users\solivetti\AppData\Roaming\Python\Python39\site-packages\pysal\lib\weights\util.py", line 1030, in get_points_array
          data = np.vstack([shape for shape in iterable])
          File "C:\Users\solivetti\AppData\Roaming\Python\Python39\site-packages\pysal\lib\weights\util.py", line 1030, in 
          data = np.vstack([shape for shape in iterable])
          File "C:\Users\solivetti\AppData\Roaming\Python\Python39\site-packages\pysal\lib\io\fileio.py", line 254, in __next__
          r = self.__read()
          File "C:\Users\solivetti\AppData\Roaming\Python\Python39\site-packages\pysal\lib\io\fileio.py", line 315, in __read
          row = self._read()
          File "C:\Users\solivetti\AppData\Roaming\Python\Python39\site-packages\pysal\lib\io\iohandlers\pyShpIO.py", line 144, in _read
          rec = self.dataObj.get_shape(self.pos)
          File "C:\Users\solivetti\AppData\Roaming\Python\Python39\site-packages\pysal\lib\io\util\shapefile.py", line 382, in get_shape
          return self.shape.unpack(io.BytesIO(self.fileObj.read(byts)))
          File "C:\Users\solivetti\AppData\Roaming\Python\Python39\site-packages\pysal\lib\io\util\shapefile.py", line 631, in unpack
          return _unpackDict(cls.USTRUCT, dat)
          File "C:\Users\solivetti\AppData\Roaming\Python\Python39\site-packages\pysal\lib\io\util\shapefile.py", line 135, in _unpackDict
          items = unpack(struct['order'] + struct['fmt'],
         struct.error: unpack requires a buffer of 20 bytes

Thanks for your attention,
Luigi M. Solivetti
Sapienza University of Rome

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions