[Qgis-developer] Point sampling tool fails on identify

Pedro Venâncio pedrongvenancio at yahoo.com
Thu Oct 25 15:00:56 PDT 2012


Hi,

I think this is happening with all the plugins that collect data from raster layers. For example, 

Value tool:

Traceback (most recent call last):
  File "/home/pedro/.qgis//python/plugins/valuetool/valuewidget.py", line 285, in printValue
    isok,ident = layer.identify(pos)
AttributeError: 'QgsRasterLayer' object has no attribute 'identify'


Profile tool:

Traceback (most recent call last):
  File "/home/pedro/.qgis//python/plugins/profiletool/profileplugin.py", line 189, in doubleClicked
    self.doprofile.calculateProfil(self.pointstoDraw,self.mdl, self.plotlibrary)
  File "/home/pedro/.qgis//python/plugins/profiletool/tools/doprofile.py", line 79, in calculateProfil
    self.profiles[i] = DataReaderTool().dataReaderTool(self.iface, self.tool, self.profiles[i], self.pointstoDraw, self.dockwidget.checkBox.isChecked())
  File "/home/pedro/.qgis//python/plugins/profiletool/tools/dataReaderTool.py", line 117, in dataReaderTool
    ident = layer.identify(QgsPoint(xC,yC))
AttributeError: 'QgsRasterLayer' object has no attribute 'identify'




Pedro



________________________________
From: G. Allegri 

I notice that the identify type is not required.
Simply changing:

ident = rastLayer.identify(point)[1]

to 

ident = rastLayer.dataProvider().identify(point)[1]

should work...


2012/10/19 G. Allegri <giohappy at gmail.com>

AFAICS the identify method has moved to QgsRasterDataProvider, and has changed the signature (now you pass the type of identify).
>The pointsamplingtool should be upgraded.
>
>
>giovanni
>
>
>2012/10/19 Paolo Cavallini <cavallini at faunalia.it>
>
>Hi all.
>>With current osgeo4w, PST fails with:
>>
>>  File "/home/paolo/.qgis//python/plugins/pointsamplingtool/doPointSamplingTool.py", line 273, in accept
>>    self.sampling(outPath)
>>  File
      "/home/paolo/.qgis//python/plugins/pointsamplingtool/doPointSamplingTool.py",
      line 345, in sampling
>>    ident = rastLayer.identify(point)[1]
>>AttributeError: 'QgsRasterLayer' object has no attribute
      'identify'
>>Is this related to:
>>https://github.com/qgis/Quantum-GIS/commit/b5412cbf950d489c824ff322e0ae9a312f4a06da
>>and fixed with it?
>>Thanks.
>>


More information about the Qgis-developer mailing list