4

I have a plugin that loads a Raster image and selects the correct base maps to use. The Raster image load with no problem, but my base maps will not load.

I have create a qlr, which has 5 references. I can drop it into the Layer pane, so I know that the file is good.

What is wrong with my script?

# get a handle to the layer groups form the default project 
rootLayers = QgsProject.instance().layerTreeRoot()

 # load an group the base layers 
 vlayer = QgsVectorLayer(self.Settings.staticLayer,"static","ogr")

 # load and group the raster 
 rlayer = QgsRasterLayer(self.rasterFile.fileName(),"analysis")    


 QgsMapLayerRegistry.instance().addMapLayer(vlayer)
 rootLayers.findGroup("Static").addLayer(vlayer)
 QgsMapLayerRegistry.instance().addMapLayer(rlayer)
 rootLayers.findGroup("Analysis").addLayer(rlayer)

closed as unclear what you're asking by PolyGeo Feb 1 '18 at 23:19

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

Browse other questions tagged or ask your own question.