<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";
        mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:"Courier New";
        mso-fareast-language:EN-CA;}
span.pln
        {mso-style-name:pln;}
span.pun
        {mso-style-name:pun;}
span.typ
        {mso-style-name:typ;}
span.str
        {mso-style-name:str;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";
        mso-fareast-language:EN-US;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-CA" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal">Is it possible to specify the output type for gdal.Rasterize, similar to gdal.Warp and others? I don’t see why the option would be available in the command line utility but not through the binding. It looks to be hardcoded in the source
 (<a href="https://github.com/OSGeo/gdal/blob/ba920209a2443b5a8492a23c16dd67fd53114c66/gdal/apps/gdal_rasterize_lib.cpp#L764">https://github.com/OSGeo/gdal/blob/ba920209a2443b5a8492a23c16dd67fd53114c66/gdal/apps/gdal_rasterize_lib.cpp#L764</a>).<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Is it possible to fix or is there a workaround? For me the result is a much file than required (and associated slower I/O, increased memory usage).<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Example usage:<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal" style="background:#F4EAEA"><span style="font-size:10.0pt;font-family:Consolas;color:#303336;border:none windowtext 1.0pt;padding:0cm;mso-fareast-language:EN-CA">myoptions = gdal.</span><span style="font-size:10.0pt;font-family:Consolas;color:#2B91AF;border:none windowtext 1.0pt;padding:0cm;mso-fareast-language:EN-CA">RasterizeOptions</span><span style="font-size:10.0pt;font-family:Consolas;color:#303336;border:none windowtext 1.0pt;padding:0cm;mso-fareast-language:EN-CA">(attribute=</span><span style="font-size:10.0pt;font-family:Consolas;color:#7D2727;border:none windowtext 1.0pt;padding:0cm;mso-fareast-language:EN-CA">"MYATTRIBUTE"</span><span style="font-size:10.0pt;font-family:Consolas;color:#303336;border:none windowtext 1.0pt;padding:0cm;mso-fareast-language:EN-CA">)<o:p></o:p></span></p>
<p class="MsoNormal" style="background:#F4EAEA"><span style="font-size:10.0pt;font-family:Consolas;color:#303336;border:none windowtext 1.0pt;padding:0cm;mso-fareast-language:EN-CA">gdal.</span><span style="font-size:10.0pt;font-family:Consolas;color:#2B91AF;border:none windowtext 1.0pt;padding:0cm;mso-fareast-language:EN-CA">Rasterize</span><span style="font-size:10.0pt;font-family:Consolas;color:#303336;border:none windowtext 1.0pt;padding:0cm;mso-fareast-language:EN-CA">(dst_path,
 src_path, options=myoptions)</span><span style="font-size:10.0pt;font-family:Consolas;color:#393318;mso-fareast-language:EN-CA"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;mso-fareast-language:EN-CA"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;mso-fareast-language:EN-CA">where the paths are direct file names to a Shapefile and a GeoTiff otput.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;mso-fareast-language:EN-CA"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;mso-fareast-language:EN-CA">Thank you,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;mso-fareast-language:EN-CA"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;mso-fareast-language:EN-CA">Benjamin<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</body>
</html>