[gdal-dev] Re: Convert vector to raster with colored polygons

spiderplant0 spiderplant0 at gmail.com
Tue May 24 17:28:07 EDT 2011


Hi, Thanks for the reply.

When I tried this first, the image was displaying just black and white. But
after some experimentation I discovered that '-ot Byte' with gdal_rasterize
gave polygons colored various shades of grey - though not related to my
attribute - seemed to be random.

I dont understand what you mean by 'If the RGB values are in separate
attributes'. I have one attribute and I want the polygon to be colored
depending on the value of the attribute for this polygon. Eg
if attribute is between 100 and 199 color polygon green
if the attribute is between 200 and 299 color polygon red 
etc
(I can change the attribute to discrete integer levels if ranges aren't
allowed).

I type this:
gdal_rasterize -ts 500 900 -ot Byte -a attributeName -l layerName 
vectorFilename.shp rasterFilename.tiff 

Though I'm not sure if this is correct. I guess this is a greyscale image
and not full color. Can't figure out how to get full color.

Do you know how to add a color table? Is there a gdal utility for this?

I couldn't find much on the web to explain how to add a color table other
than a suggestion for converting to a .vrt and manually editing the file. I
guess I want a palette raster? But I couldnt figure out the format of the
color table. Or how to specify that the background should be transparent.

Any clues you can give me would be appreciated.


--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/Convert-vector-to-raster-with-colored-polygons-tp6396185p6400545.html
Sent from the GDAL - Dev mailing list archive at Nabble.com.


More information about the gdal-dev mailing list