[Qgis-developer] add rasterlayer to qgsmapcanvas

Tim Sutton lists at linfiniti.com
Thu Jun 5 11:20:07 PDT 2014


Hi



On Fri, Jun 6, 2014 at 12:15 AM, Felix Schmidt <felix.schmidt at uni-weimar.de>
wrote:

> 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.
>>>
>>>
Is the layer loaded, showing in the legend but just not visible? Check the
symbology for the layer is defined properly if this is the case.

Regards

Tim


>  please help me.
>>>
>>> Felix
>>>
>>>
>>>
>>> _______________________________________________
>>> Qgis-developer mailing list
>>> Qgis-developer at lists.osgeo.org
>>> http://lists.osgeo.org/mailman/listinfo/qgis-developer
>>>
>>
> _______________________________________________
> Qgis-developer mailing list
> Qgis-developer at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-developer
>



-- 
Tim Sutton - QGIS Project Steering Committee Member
==============================================
Please do not email me off-list with technical
support questions. Using the lists will gain
more exposure for your issues and the knowledge
surrounding your issue will be shared with all.

Irc: timlinux on #qgis at freenode.net
==============================================
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20140606/7e363f26/attachment-0001.html>


More information about the Qgis-developer mailing list