1GDAL_POLYGONIZE(1) GDAL GDAL_POLYGONIZE(1)
2
3
4
6 gdal_polygonize - Produces a polygon feature layer from a raster.
7
9 gdal_polygonize.py [-8] [-nomask] [-mask filename] <raster_file> [-b band]
10 [-q] [-f ogr_format] <out_file> [layer] [fieldname]
11
13 This utility creates vector polygons for all connected regions of pix‐
14 els in the raster sharing a common pixel value. Each polygon is cre‐
15 ated with an attribute indicating the pixel value of that polygon. A
16 raster mask may also be provided to determine which pixels are eligible
17 for processing.
18
19 The utility will create the output vector datasource if it does not al‐
20 ready exist, defaulting to GML format.
21
22 The utility is based on the :GDALPolygonize() function which has addi‐
23 tional details on the algorithm.
24
25 -8 Use 8 connectedness. Default is 4 connectedness.
26
27 -nomask
28 Do not use the default validity mask for the input band (such as
29 nodata, or alpha masks).
30
31 -mask <filename>
32 Use the first band of the specified file as a validity mask
33 (zero is invalid, non-zero is valid). If not specified, the de‐
34 fault validity mask for the input band (such as nodata, or alpha
35 masks) will be used (unless -nomask is specified)
36
37 <raster_file>
38 The source raster file from which polygons are derived.
39
40 -b <band>
41 The band on <raster_file> to build the polygons from. Starting
42 with GDAL 2.2, the value can also be set to "mask", to indicate
43 that the mask band of the first band must be used (or
44 "mask,band_number" for the mask of a specified band)
45
46 -f <ogr_format>
47 Select the output format. Starting with GDAL 2.3, if not speci‐
48 fied, the format is guessed from the extension (previously was
49 GML). Use the short format name
50
51 <out_file>
52 The destination vector file to which the polygons will be writ‐
53 ten.
54
55 <layer>
56 The name of the layer created to hold the polygon features.
57
58 <fieldname>
59 The name of the field to create (defaults to "DN").
60
61 -q The script runs in quiet mode. The progress monitor is sup‐
62 pressed and routine messages are not displayed.
63
65 Frank Warmerdam <warmerdam@pobox.com>
66
68 1998-2021
69
70
71
72
73 Sep 07, 2021 GDAL_POLYGONIZE(1)