[Qgis-developer] How to color a raster with a color table with values From - To?

Etienne Tourigny etourigny.dev at gmail.com
Wed Aug 8 10:07:18 PDT 2012


Hi,

which version of the api are you using? If you are using the
development version (1.9), there is support for more flexible color
ramps with rasters, using QgsVectorColorRampV2. Beware, however, that
the api is going to suffer some changes in the near future. There are
various recent threads on this subject in this mailing list.

Another option (and the only available if using 1.8) is to follow the
approach used in the rasterlayer test in
tests/src/core/testqgsrasterlayer.cpp .
TestQgsRasterLayer::pseudoColor() uses a ColorRampItem vector and
calls colorRampShader->setColorRampItemList(items)

Etienne

On Wed, Aug 8, 2012 at 3:42 AM, SupportLists <supportlists at qlands.com> wrote:
> Hi,
>
> I am using QGIS API to develop a custom application. Currently I'm using
> QgsRasterLayer::PalettedColor + QgsRasterLayer::ColorRampShader  +
> QgsColorRampShader::ColorRampItem to render a raster using a specific color
> map.
>
> Now, I need to render the raster with a colormap using value From - To
> however, ColorRampItem struct only accepts one value. Is there another way
> around? Or, its it possible to create user defined DrawingStyles and
> ColorShadingAlgorithms? If so how?
>
> Any help is very much appreciated.
>
> Regards,
> Carlos.
> _______________________________________________
> Qgis-developer mailing list
> Qgis-developer at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-developer


More information about the Qgis-developer mailing list