gdal_rasterize(1)

NAME
gdal_rasterize - gdal_rasterize burns vector polygons into a raster

SYNOPSIS

Usage: gdal_rasterize [-b band] [-i]
       [-burn value] | [-a attribute_name] | [-3d]
       [-l layername]* [-where expression] [-sql select_statement]
       <src_datasource> <dst_filename>

DESCRIPTION

This program burns vector polygons into the raster band(s) of a raster image. Vectors are read from OGR supported vector formats.

-b band:
    The band(s) to burn values into. Multiple -b arguments may be used to burn into a list of bands. The default is to burn into band 1.

-i: Invert rasterization. Burn the fixed burn value, or the burn value associated with the first feature into all parts of the image not inside a polygon.

-burn value:
    A fixed value to burn into a band for all objects. A list of -burn options can be supplied, one per band being written to.

-a attribute_name:
    Identifies an attribute field on the features to be used for a burn in value. The value will be burned into all output bands.

-3d:
    Indicates that a burn value should be extracted from the 'Z' values of the feature (not yet implemented).

-l layername:
    Indicates the layer(s) from the datasource that will be used for input features. May be specified multiple times, but at least one layer name or a -sql option must be specified.

-where expression:
    An optional SQL WHERE style query expression to be applied to select features to burn in from the input layer(s).

-sql select_statement:
    An SQL statement to be evaluated against the datasource to produce a virtual layer of features to be burned in.

src_datasource:
    Any OGR supported readable datasource.

dst_filename:
    The GDAL supported output file. Must support update mode access. Currently gdal_rasterize cannot create new output files though that may be added eventually.

EXAMPLE

The following would burn all polygons from mask.shp into the RGB TIFF file work.tif with the color red (RGB = 255,0,0).

gdal_rasterize -b 1 -b 2 -b 3 -burn 255 -burn 0 -burn 0 -l mask mask.shp work.tif

The following would burn all 'class A' buildings into the output elevation file, pulling the top elevation from the ROOF_H attribute.

gdal_rasterize -a ROOF_H -where 'class="A"' -l footprints footprints.shp city_dem.tif

AUTHORS

Frank Warmerdam <warmerdam@pobox.com>