[Qgis-developer] add rasterlayer to qgsmapcanvas

Felix Schmidt felix.schmidt at uni-weimar.de
Thu Jun 5 10:15:39 PDT 2014


Same mistake with refresh() at the end.

Am 05.06.2014 19:11, schrieb Rouzaud Denis:
> self.canvasRaster.refresh() at the end ?
>
> On 05 Jun 2014, at 18:27, Felix Schmidt <felix.schmidt at uni-weimar.de> wrote:
>
>>
>>
>>
>> Hello everyone,
>> I try to load on signal, a rasterlayer to qgsmapcanvas. I try it like in
>> the pycookbook:
>>
>> @QtCore.pyqtSlot()
>>      def loadRasterImage(self):
>>      print "slot works"
>>          fileName = QFileDialog.getOpenFileName(None, "historical map",
>> ".", "Image Files (*.png *.jpg *.bmp *.tiff)")
>>          fileInfo = QFileInfo(fileName)
>>          baseName = fileInfo.baseName()
>>          rlayer = QgsRasterLayer(fileName, baseName)
>>          if not rlayer.isValid():
>>              print "Layer failed to load!"
>>          QgsMapLayerRegistry.instance().addMapLayer(rlayer)
>>      print rlayer.extent().yMinimum()
>>      self.canvasRaster.setExtent(rlayer.extent())
>>      self.canvasRaster.setLayerSet( [ QgsMapCanvasLayer(rlayer) ] )
>>
>> self.canvasRaster is defined in the gui . I search for 8h but I dont
>> find a solutionen, because there are no errors.
>>
>> It load the rasterlayer to the main program of qgis, but not in my
>> qgsmapcanvas. it is still white.
>>
>> please help me.
>>
>> Felix
>>
>>
>>
>> _______________________________________________
>> Qgis-developer mailing list
>> Qgis-developer at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/qgis-developer



More information about the Qgis-developer mailing list