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

Chaitanya kumar CH chaitanya.ch at gmail.com
Mon May 23 19:02:46 EDT 2011


I am assuming that you have a greyscale image. Not just black(0) and
white (255) areas.
gdal_rasterize does not create a colour table for the generated
raster. You need to add one to the newly created table.

If the RGB values are in separate attributes, you can burn each one
into a separate band to create a colourful raster.

On 5/24/11, spiderplant0 <spiderplant0 at gmail.com> wrote:
> Hi, I have a vector file that consists of polygons that are colored
> according
> to the value of an attribute.
> I wish to convert this vector to a raster file and preserve the coloring
> information. Is this possible with gdal_rasterize?
> I have used this command...
> gdal_rasterize -ts 8447 7058 -a attributeName -l layerName
> vectorFilename.shp rasterFilename.tiff
> However this just seems to generate a black and white raster file. I've read
> everything I can find on gdal_translate but cant figure out how to fix in
> the color information.
> I'll use the raster image generated by this step to feed into gdal2tiles to
> generate googleMap tiles.
> I'm using gdal 1.8
> Thanks.
> --
> View this message in context:
> http://osgeo-org.1803224.n2.nabble.com/Convert-vector-to-raster-with-colored-polygons-tp6396185p6396185.html
> Sent from the GDAL - Dev mailing list archive at Nabble.com.
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev

Best regards,
Chaitanya kumar CH.
/tʃaɪθənjə/ /kʊmɑr/
17.2416N 80.1426E

More information about the gdal-dev mailing list