1gdal_rasterize(1) General Commands Manual gdal_rasterize(1)
2
3
4
6 gdal_rasterizeBurns vector geometries into a raster.
7
9 Usage: gdal_rasterize [-b band]* [-i] [-at]
10 {[-burn value]* | [-a attribute_name] | [-3d]} [-add]
11 [-l layername]* [-where expression] [-sql select_statement]
12 [-dialect dialect] [-of format] [-a_srs srs_def] [-to NAME=VALUE]*
13 [-co "NAME=VALUE"]* [-a_nodata value] [-init value]*
14 [-te xmin ymin xmax ymax] [-tr xres yres] [-tap] [-ts width height]
15 [-ot {Byte/Int16/UInt16/UInt32/Int32/Float32/Float64/
16 CInt16/CInt32/CFloat32/CFloat64}] [-q]
17 <src_datasource> <dst_filename>
18
20 This program burns vector geometries (points, lines, and polygons) into
21 the raster band(s) of a raster image. Vectors are read from OGR
22 supported vector formats.
23
24 Note that on the fly reprojection of vector data to the coordinate
25 system of the raster data is only supported since GDAL 2.1.0.
26
27 Prior to GDAL 1.8.0, gdal_rasterize could only modify existing raster
28 images. Since 1.8.0, it will create a new target raster image when any
29 of the -of, -a_nodata, -init, -a_srs, -co, -te, -tr, -tap, -ts, or -ot
30 options are used. The resolution or size must be specified using the
31 -tr or -ts option for all new rasters. The target raster will be
32 overwritten if it already exists and any of these creation-related
33 options are used.
34
35 -b band:
36 The band(s) to burn values into. Multiple -b arguments may be used
37 to burn into a list of bands. The default is to burn into band 1.
38 Not used when creating a new raster.
39
40 -i:
41 Invert rasterization. Burn the fixed burn value, or the burn value
42 associated with the first feature into all parts of the image not
43 inside the provided polygon.
44
45 -at:
46 Enables the ALL_TOUCHED rasterization option so that all pixels
47 touched by lines or polygons will be updated, not just those on the
48 line render path, or whose center point is within the polygon.
49 Defaults to disabled for normal rendering rules.
50
51 -burn value:
52 A fixed value to burn into a band for all objects. A list of -burn
53 options can be supplied, one per band being written to.
54
55 -a attribute_name:
56 Identifies an attribute field on the features to be used for a
57 burn-in value. The value will be burned into all output bands.
58
59 -3d:
60 Indicates that a burn value should be extracted from the 'Z' values
61 of the feature. Works with points and lines (linear interpolation
62 along each segment). For polygons, works properly only if the are
63 flat (same Z value for all vertices).
64
65 -add:
66 Instead of burning a new value, this adds the new value to the
67 existing raster. Suitable for heatmaps for instance.
68
69 -l layername:
70 Indicates the layer(s) from the datasource that will be used for
71 input features. May be specified multiple times, but at least one
72 layer name or a -sql option must be specified.
73
74 -where expression:
75 An optional SQL WHERE style query expression to be applied to
76 select features to burn in from the input layer(s).
77
78 -sql select_statement:
79 An SQL statement to be evaluated against the datasource to produce
80 a virtual layer of features to be burned in.
81
82 -dialect dialect:
83 (GDAL >= 2.1.0) SQL dialect. In some cases can be used to use
84 (unoptimized) OGR SQL instead of the native SQL of an RDBMS by
85 passing OGRSQL. Starting with GDAL 1.10, the 'SQLITE' dialect can
86 also be used with any datasource.
87
88 -of format:
89 (GDAL >= 1.8.0) Select the output format. Starting with GDAL 2.3,
90 if not specified, the format is guessed from the extension
91 (previously was GTiff). Use the short format name.
92
93 -a_nodata value:
94 (GDAL >= 1.8.0) Assign a specified nodata value to output bands.
95
96 -init value:
97 (GDAL >= 1.8.0) Pre-initialize the output image bands with these
98 values. However, it is not marked as the nodata value in the output
99 file. If only one value is given, the same value is used in all the
100 bands.
101
102 -a_srs srs_def:
103 (GDAL >= 1.8.0) Override the projection for the output file. If not
104 specified, the projection of the input vector file will be used if
105 available. When using this option, no reprojection of features from
106 the SRS of the input vector to the specified SRS of the output
107 raster, so use only this option to correct an invalid source SRS.
108 The srs_def may be any of the usual GDAL/OGR forms, complete WKT,
109 PROJ.4, EPSG:n or a file containing the WKT.
110
111 -to NAME=VALUE:
112 (GDAL >= 2.3.0) set a transformer option suitable to pass to
113 GDALCreateGenImgProjTransformer2(). This is used when converting
114 geometries coordinates to target raster pixel space. For example
115 this can be used to specify RPC related transformer options.
116
117 -co 'NAME=VALUE':
118 (GDAL >= 1.8.0) Passes a creation option to the output format
119 driver. Multiple -co options may be listed. See format specific
120 documentation for legal creation options for each format.
121
122 -te xmin ymin xmax ymax :
123 (GDAL >= 1.8.0) Set georeferenced extents. The values must be
124 expressed in georeferenced units. If not specified, the extent of
125 the output file will be the extent of the vector layers.
126
127 -tr xres yres :
128 (GDAL >= 1.8.0) Set target resolution. The values must be expressed
129 in georeferenced units. Both must be positive values.
130
131 -tap:
132 (GDAL >= 1.8.0) (target aligned pixels) Align the coordinates of
133 the extent of the output file to the values of the -tr, such that
134 the aligned extent includes the minimum extent.
135
136 -ts width height:
137 (GDAL >= 1.8.0) Set output file size in pixels and lines. Note that
138 -ts cannot be used with -tr
139
140 -ot type:
141 (GDAL >= 1.8.0) For the output bands to be of the indicated data
142 type. Defaults to Float64
143
144 -q:
145 (GDAL >= 1.8.0) Suppress progress monitor and other non-error
146 output.
147
148 src_datasource:
149 Any OGR supported readable datasource.
150
151 dst_filename:
152 The GDAL supported output file. Must support update mode access. As
153 of GDAL 1.8.0, this file will be created (or overwritten if it
154 already exists) if the -of, -a_nodata, -init, -a_srs, -co, -te,
155 -tr, -tap, -ts, or -ot options are used.
156
158 Starting with GDAL 2.1, this utility is also callable from C with
159 GDALRasterize().
160
162 The following would burn all polygons from mask.shp into the RGB TIFF
163 file work.tif with the color red (RGB = 255,0,0).
164
165 gdal_rasterize -b 1 -b 2 -b 3 -burn 255 -burn 0 -burn 0 -l mask mask.shp work.tif
166
167 The following would burn all 'class A' buildings into the output
168 elevation file, pulling the top elevation from the ROOF_H attribute.
169
170 gdal_rasterize -a ROOF_H -where 'class="A"' -l footprints footprints.shp city_dem.tif
171
172 The following would burn all polygons from footprint.shp into a new
173 1000x1000 rgb TIFF as the color red. Note that -b is not used; the
174 order of the -burn options determines the bands of the output raster.
175
176 gdal_rasterize -burn 255 -burn 0 -burn 0 -ot Byte -ts 1000 1000 -l footprints footprints.shp mask.tif
177
179 Frank Warmerdam warmerdam@pobox.com
180
181
182
183GDAL Tue Mar 3 2020 gdal_rasterize(1)