[Qgis-developer] How can I program a raster legend using PyQGIS?

Tim Sutton tim at linfiniti.com
Wed Jan 16 09:27:41 EST 2008


QgsRasterLayer has a method rasterLayer->getPaletteAsPixmap() which
gets a pixmap with a pallette swatch on it. I dont know if this is
available from the python bindings (I'm guessing it is), or if it
meets your needs...



2008/1/16, René Estrella <perro1255 at hotmail.com>:
> >
> >On Jan 15, 2008 9:45 PM, René Estrella <perro1255 at hotmail.com> wrote:
> >> I'm trying to program a kind of raster layer component using PyQGIS
> >> either
> >> as a plugin or as a standalone application.  Which classes of QGIS API do
> >> you recommend me to use?  Do you suggest me to use QgsColorTable in
> >> conjunction with QgsRasterLayer to obtain the symbology of the raster
> >> layer
> >> and display it in a QgsLegend?  Are there any other classes do I have to
> >> know about for this purpose?  Aditionally, if you can direct me to a good
> >> documentation resource to learning how to use PyQGIS (very
> >> beginner-oriented) I would be very thankful to you.
> >Hi,
> >I don't get what you mean by "raster layer component"...
> Hi, Martin.  Thanks so much for your answer.  There's an error in my last
> post.  I need to develop a raster LEGEND component, not a raster layer
> component.  Excuse me for that mistake.  What I particularly need is to
> display several Ascii Grid Rasters in the map canvas of QGIS, and, attached
> to it a legend component showing the list of layers loaded and for each
> layer the symbology indicating the colors corresponding to each pixel value
> of the raster layer.  I mean, something similar to the vector layer legend,
> where you can categorize the information and assign a color for each
> category, and things like those.  It seems it's not possible to obtain such
> a legend for an ascii grid raster layer with the current functionality
> included in QGIS.  Because of that, I think the only way to do that is to
> develop a plugin for producing the legend.  Am I right or there is something
> more I should know about this topic?  Could you give me some guidance to
> start developing such a component?
> Thanks again and best regards.
> René Estrella
> --
> View this message in context: http://www.nabble.com/How-can-I-program-a-raster-legend-using-PyQGIS--tp14846130p14881331.html
> Sent from the qgis-developer mailing list archive at Nabble.com.
> _______________________________________________
> Qgis-developer mailing list
> Qgis-developer at lists.qgis.org
> http://lists.qgis.org/cgi-bin/mailman/listinfo/qgis-developer

Tim Sutton
QGIS Project Steering Committee Member - Release  Manager
Visit http://qgis.org for a great open source GIS
openModeller Desktop Developer
Visit http://openModeller.sf.net for a great open source ecological
niche modelling tool
Home Page: http://tim.linfiniti.com
Skype: timlinux
Irc: timlinux on #qgis at freenode.net

More information about the Qgis-developer mailing list