[Qgis-developer] How to load a colour table on a raster, programmatically (in python)?

Benoit de Cabissole benoit at exigesa.com
Wed Aug 11 04:17:50 EDT 2010


Martin,

Thanks for the clarification and prompt answer.
As the French say: "je comprend vite, mais il faut m'expliquer longtemps !"

Cheers,
Benoit

> -----Original Message-----
> From: Martin Dobias [mailto:wonder.sk at gmail.com]
> Sent: Wednesday, 11 August 2010 10:08
> To: benoit at exigesa.com
> Cc: qgis-developer at lists.osgeo.org
> Subject: Re: [Qgis-developer] How to load a colour table on a raster,
> programmatically (in python)?
>
>
> On Wed, Aug 11, 2010 at 9:26 AM, Benoit de Cabissole
> <benoit at exigesa.com> wrote:
> >
> > Something is still bothering me: what does happen if the raster
> is cached
> > before I set the cache to None?
> > I've tried the following code:
> >
> >  # - backup current cache state
> >  bQI = theLayer.cacheImage()
> >  if bQI != None: theLayer.setCacheImage( None )
> >
> >  ... refresh raster ...
> >
> >  # - restore the state of image cache
> >  theLayer.setCacheImage( bQI )
>
> The render cache works as follows: if there's a cached image and the
> current extent has not changed, the cached image will be used. If the
> cached image is not available (i.e. set to None), the layer will be
> rendered again (and new cache image will be set). So with this code,
> you would set the old cache image again - not something you want. All
> you want is to remove the old cache image.
>
> > It runs with no error, but on exit of QGIS it bombs out!
>
> There was a small problem with python bindings (now fixed in r14053),
> but again, there's no reason why you would want to do that.
>
>
> Cheers
> Martin



More information about the Qgis-developer mailing list