I am trying to get some layers into a MapCanvas and style them. I am following the PyQgis Cookbook info here but my code is just not working. I've been spinning my wheels on this for over a week now and there's no one in my office familiar enough with python/qgis. What am I missing???

canvas1.setLayerSet( [QgsMapCanvasLayer(layer1)] )
Traceback (most recent call last):
File "<input>", line 1, in <module>
NameError: name 'QgsMapCanvasLayer' is not defined

In R you just do this:

nta <- readOGR("my/path", "mylayer")
spplot(nta, zcol="symbolAttributes")
  • page 20 of this PyQgis Cookbook walks you through symbolizing with two groups of ranges, but I can't seem to translate this into a simple, regular categorized classification. – mikeLdub Nov 19 '13 at 21:13
  • Are you trying to do this in a normal Python file outside QGIS? – Nathan W Nov 19 '13 at 22:08
  • no, python console in qgis desktop 1.8 – mikeLdub Nov 19 '13 at 22:09
  • 2
    from qgis.gui import * – Nathan W Nov 19 '13 at 22:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.