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] [-o name=value]* [-nomask] [-mask filename] <raster_file> [-b band]
10 [-q] [-f ogr_format] [-lco name=value]* <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 -o NAME=VALUE
52 New in version 3.7.
53
54
55 Polygonize option. See :GDALPolygonize() documentation.
56
57 -lco NAME=VALUE
58 New in version 3.7.
59
60
61 Layer creation option (format specific)
62
63 <out_file>
64 The destination vector file to which the polygons will be writ‐
65 ten.
66
67 <layer>
68 The name of the layer created to hold the polygon features.
69
70 <fieldname>
71 The name of the field to create (defaults to "DN").
72
73 -q The script runs in quiet mode. The progress monitor is sup‐
74 pressed and routine messages are not displayed.
75
77 Frank Warmerdam <warmerdam@pobox.com>
78
80 1998-2023
81
82
83
84
85 Oct 30, 2023 GDAL_POLYGONIZE(1)