<!-- This comment will put IE 6, 7 and 8 in quirks mode --> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <title>gdal_rasterize</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <link href="search/search.css" rel="stylesheet" type="text/css"/> <script type="text/javaScript" src="search/search.js"></script> <link href="doxygen.css" rel="stylesheet" type="text/css"/> </head> <body onload='searchBox.OnSelectItem(0);'> <!-- Generated by Doxygen 1.6.2-20100208 --> <script type="text/javascript"><!-- var searchBox = new SearchBox("searchBox", "search",false,'Search'); --></script> <div class="navigation" id="top"> <div class="tabs"> <ul> <li><a href="index.html"><span>Main Page</span></a></li> <li class="current"><a href="pages.html"><span>Related Pages</span></a></li> <li> <div id="MSearchBox" class="MSearchBoxInactive"> <img id="MSearchSelect" src="search/search.png" onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" alt=""/> <input type="text" id="MSearchField" value="Search" accesskey="S" onfocus="searchBox.OnSearchFieldFocus(true)" onblur="searchBox.OnSearchFieldFocus(false)" onkeyup="searchBox.OnSearchFieldChange(event)"/> <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a> </div> </li> </ul> </div> </div> <div class="contents"> <h1><a class="anchor" id="gdal_rasterize">gdal_rasterize </a></h1><p>burns vector polygons into a raster</p> <h2><a class="anchor" id="zsynopsis"> SYNOPSIS</a></h2> <div class="fragment"><pre class="fragment"> Usage: gdal_rasterize [-b band] [-i] [-burn value] | [-a attribute_name] | [-3d] [-l layername]* [-where expression] [-sql select_statement] <src_datasource> <dst_filename> </pre></div><h2><a class="anchor" id="zdescription"> DESCRIPTION</a></h2> <p>This program burns vector polygons into the raster band(s) of a raster image. Vectors are read from OGR supported vector formats.</p> <dl> <dt><b>-b</b> <em>band</em>: </dt> <dd><p class="startdd">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.</p> <p class="enddd"></p> </dd> <dt><b>-i</b>: </dt> <dd><p class="startdd">Invert rasterization. Burn the fixed burn value, or the burn value associated with the first feature into all parts of the image <em>not</em> inside a polygon.</p> <p class="enddd"></p> </dd> <dt><b>-burn</b> <em>value</em>: </dt> <dd><p class="startdd">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.</p> <p class="enddd"></p> </dd> <dt><b>-a</b> <em>attribute_name</em>: </dt> <dd><p class="startdd">Identifies an attribute field on the features to be used for a burn in value. The value will be burned into all output bands.</p> <p class="enddd"></p> </dd> <dt><b>-3d</b>: </dt> <dd><p class="startdd">Indicates that a burn value should be extracted from the "Z" values of the feature (not yet implemented).</p> <p class="enddd"></p> </dd> <dt><b>-l</b> <em>layername</em>: </dt> <dd><p class="startdd">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.</p> <p class="enddd"></p> </dd> <dt><b>-where</b> <em>expression</em>: </dt> <dd><p class="startdd">An optional SQL WHERE style query expression to be applied to select features to burn in from the input layer(s). </p> <p class="enddd"></p> </dd> <dt><b>-sql</b> <em>select_statement</em>: </dt> <dd><p class="startdd">An SQL statement to be evaluated against the datasource to produce a virtual layer of features to be burned in.</p> <p class="enddd"></p> </dd> <dt><em>src_datasource</em>: </dt> <dd><p class="startdd">Any OGR supported readable datasource.</p> <p class="enddd"></p> </dd> <dt><em>dst_filename</em>: </dt> <dd><p class="startdd">The GDAL supported output file. Must support update mode access. Currently gdal_rasterize cannot create new output files though that may be added eventually.</p> <p class="enddd"></p> </dd> </dl> <h2><a class="anchor" id="zexample"> EXAMPLE</a></h2> <p>The following would burn all polygons from mask.shp into the RGB TIFF file work.tif with the color red (RGB = 255,0,0).</p> <div class="fragment"><pre class="fragment"> gdal_rasterize -b 1 -b 2 -b 3 -burn 255 -burn 0 -burn 0 -l mask mask.shp work.tif </pre></div><p>The following would burn all "class A" buildings into the output elevation file, pulling the top elevation from the ROOF_H attribute.</p> <div class="fragment"><pre class="fragment"> gdal_rasterize -a ROOF_H -where 'class="A"' -l footprints footprints.shp city_dem.tif </pre></div> </div> <!--- window showing the filter options --> <div id="MSearchSelectWindow" onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> </div> <!-- iframe showing the search results (closed by default) --> <div id="MSearchResultsWindow"> <iframe src="" frameborder="0" name="MSearchResults" id="MSearchResults"> </iframe> </div> <hr> Generated for GDAL by <a href="http://www.doxygen.org/index.html"><img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.6.2-20100208. </body> </html>