Skip to content

Commit f44ec16

Browse files
committed
Address PR comments
1 parent 1c00e6d commit f44ec16

File tree

5 files changed

+57
-53
lines changed

5 files changed

+57
-53
lines changed

apps/gdalalg_vector_rasterize.cpp

+7-6
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,9 @@ GDALVectorRasterizeAlgorithm::GDALVectorRasterizeAlgorithm()
6363
&m_nodata);
6464
AddArg("init", 0, _("Pre-initialize output bands with specified value"),
6565
&m_initValues);
66-
AddArg("crs", 0, _("Override the projection for the output file"), &m_srs).AddHiddenAlias("srs").SetIsCRSArg(/*noneAllowed=*/false);
66+
AddArg("crs", 0, _("Override the projection for the output file"), &m_srs)
67+
.AddHiddenAlias("srs")
68+
.SetIsCRSArg(/*noneAllowed=*/false);
6769
AddArg("transformer-option", 0,
6870
_("Set a transformer option suitable to pass to "
6971
"GDALCreateGenImgProjTransformer2"),
@@ -75,24 +77,23 @@ GDALVectorRasterizeAlgorithm::GDALVectorRasterizeAlgorithm()
7577
.SetMaxCount(4)
7678
.SetRepeatedArgAllowed(false)
7779
.SetMetaVar("<xmin>,<ymin>,<xmax>,<ymax>");
78-
AddArg("resolution", 0, _("Set the target resolution"),
79-
&m_targetResolution)
80+
AddArg("resolution", 0, _("Set the target resolution"), &m_targetResolution)
8081
.SetMinCount(2)
8182
.SetMaxCount(2)
8283
.SetRepeatedArgAllowed(false)
8384
.SetMetaVar("<xres>,<yres>")
84-
.SetMutualExclusionGroup("target-size-or-resoulution");
85+
.SetMutualExclusionGroup("size-or-resolution");
8586
AddArg("target-aligned-pixels", 0,
8687
_("(target aligned pixels) Align the coordinates of the extent of "
87-
"the output file to the values of the target-resolution"),
88+
"the output file to the values of the resolution"),
8889
&m_tap);
8990
AddArg("size", 0, _("Set the target size in pixels and lines"),
9091
&m_targetSize)
9192
.SetMinCount(2)
9293
.SetMaxCount(2)
9394
.SetRepeatedArgAllowed(false)
9495
.SetMetaVar("<xsize>,<ysize>")
95-
.SetMutualExclusionGroup("target-size-or-resoulution");
96+
.SetMutualExclusionGroup("size-or-resolution");
9697
AddOutputDataTypeArg(&m_outputType);
9798
AddArg("optimization", 0,
9899
_("Force the algorithm used (results are identical)"),
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
.. option:: --dialect <DIALECT>
2+
3+
SQL dialect.
4+
5+
By default the native SQL of an RDBMS is used when using
6+
``gdal vector sql``. If using ``sql`` as a step of ``gdal vector pipeline``,
7+
this is only true if the step preceding ``sql`` is ``read``, otherwise the
8+
:ref:`OGRSQL <ogr_sql_dialect>` dialect is used.
9+
10+
If a datasource does not support SQL natively, the default is to use the
11+
``OGRSQL`` dialect, which can also be specified with any data source.
12+
13+
The :ref:`sql_sqlite_dialect` dialect can be chosen with the ``SQLITE``
14+
and ``INDIRECT_SQLITE`` dialect values, and this can be used with any data source.
15+
Overriding the default dialect may be beneficial because the capabilities of
16+
the SQL dialects vary. What SQL dialects a driver supports can be checked
17+
with "gdal vector info".
18+
19+
Supported dialects can be checked with ``gdal vector info``. For example:
20+
21+
.. code-block::
22+
23+
$ gdal vector info --format "PostgreSQL"
24+
Supported SQL dialects: NATIVE OGRSQL SQLITE
25+
26+
$ gdal vector info --format "ESRI Shapefile"
27+
Supported SQL dialects: OGRSQL SQLITE
28+

doc/source/programs/gdal_rasterize.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ raster data is only supported since GDAL 2.1.0.
9090

9191
Indicates that a burn value should be extracted from the "Z" values of the
9292
feature. Works with points and lines (linear interpolation along each segment).
93-
For polygons, works properly only if the are flat (same Z value for all
93+
For polygons, works properly only if they are flat (same Z value for all
9494
vertices).
9595

9696
.. option:: -add

doc/source/programs/gdal_vector_rasterize.rst

+20-21
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Synopsis
2323
2424
Positional arguments:
2525
-i, --input <INPUT> Input vector dataset [required]
26-
-o, --output <OUTPUT> Output vector dataset [required]
26+
-o, --output <OUTPUT> Output raster dataset [required]
2727
2828
Common Options:
2929
-h, --help Display help message and exit
@@ -36,12 +36,12 @@ Synopsis
3636
Options:
3737
-f, --of, --format, --output-format <OUTPUT-FORMAT> Output format
3838
--co, --creation-option <KEY>=<VALUE> Creation option [may be repeated]
39-
-b, --band <BAND> The band(s) to burn values into. [may be repeated]
39+
-b, --band <BAND> The band(s) to burn values into [may be repeated]
4040
--invert Invert the rasterization
4141
--all-touched Enables the ALL_TOUCHED rasterization option
4242
--burn <BURN> Burn value [may be repeated]
4343
-a, --attribute-name <ATTRIBUTE-NAME> Attribute name
44-
--3d Indicates that a burn value should be extracted from the Z values of the feature.
44+
--3d Indicates that a burn value should be extracted from the Z values of the feature
4545
--add Add to existing raster
4646
-l, --layer, --layer-name <LAYER-NAME> Layer name
4747
Mutually exclusive with --sql
@@ -51,16 +51,16 @@ Synopsis
5151
--dialect <DIALECT> SQL dialect
5252
--nodata <NODATA> Assign a specified nodata value to output bands
5353
--init <INIT> Pre-initialize output bands with specified value [may be repeated]
54-
--srs <SRS> Override the projection for the output file
54+
--crs <CRS> Override the projection for the output file
5555
--transformer-option <NAME>=<VALUE> Set a transformer option suitable to pass to GDALCreateGenImgProjTransformer2 [may be repeated]
56-
--target-extent <xmin> <ymin> <xmax> <ymax> Set the target georeferenced extent [4 values]
57-
--target-resolution <xres> <yres> Set the target resolution [2 values]
58-
Mutually exclusive with --target-size
59-
--tap (target aligned pixels) Align the coordinates of the extent of the output file to the values of the target-resolution
60-
--target-size <xsize> <ysize> Set the target size in pixels and lines [2 values]
61-
Mutually exclusive with --target-resolution
56+
--extent <xmin>,<ymin>,<xmax>,<ymax> Set the target georeferenced extent [4 values]
57+
--resolution <xres>,<yres> Set the target resolution [2 values]
58+
Mutually exclusive with --size
59+
--target-aligned-pixels (target aligned pixels) Align the coordinates of the extent of the output file to the values of the resolution
60+
--size <xsize>,<ysize> Set the target size in pixels and lines [2 values]
61+
Mutually exclusive with --resolution
6262
--ot, --datatype, --output-data-type <OUTPUT-DATA-TYPE> Output data type. OUTPUT-DATA-TYPE=Byte|Int8|UInt16|Int16|UInt32|Int32|UInt64|Int64|CInt16|CInt32|Float32|Float64|CFloat32|CFloat64
63-
--optimization <OPTIMIZATION> Force the algorithm used (results are identical).. OPTIMIZATION=AUTO|RASTER|VECTOR (default: AUTO)
63+
--optimization <OPTIMIZATION> Force the algorithm used (results are identical). OPTIMIZATION=AUTO|RASTER|VECTOR (default: AUTO)
6464
6565
Advanced Options:
6666
--oo, --open-option <KEY=VALUE> Open options [may be repeated]
@@ -69,6 +69,7 @@ Synopsis
6969
For more details, consult https://gdal.org/programs/gdal_vector_rasterize.html
7070
7171
72+
7273
Description
7374
-----------
7475

@@ -113,7 +114,7 @@ Standard options
113114

114115
.. option:: --3d
115116

116-
Indicates that a burn value should be extracted from the "Z" values of the feature. Works with points and lines (linear interpolation along each segment). For polygons, works properly only if the are flat (same Z value for all vertices).
117+
Indicates that a burn value should be extracted from the "Z" values of the feature. Works with points and lines (linear interpolation along each segment). For polygons, works properly only if they are flat (same Z value for all vertices).
117118

118119
.. option:: --add
119120

@@ -132,9 +133,7 @@ Standard options
132133
An SQL statement to be evaluated against the datasource to produce a virtual layer of features to be burned in.
133134
Starting with GDAL 3.7, the @filename syntax can be used to indicate that the content is in the pointed filename.
134135

135-
.. option:: --dialect <DIALECT>
136-
137-
SQL dialect. In some cases can be used to use (unoptimized) OGR SQL instead of the native SQL of an RDBMS by passing OGRSQL. The "SQLITE" dialect can also be used with any datasource.
136+
.. include:: gdal_options/sql_dialect.rst
138137

139138
.. option:: --nodata <NODATA>
140139

@@ -144,9 +143,9 @@ Standard options
144143

145144
Pre-initialize output bands with specified value. May be repeated.
146145

147-
.. option:: --crs <SRS>
146+
.. option:: --crs <CRS>
148147

149-
Override the projection for the output file. If not specified, the projection of the input vector file will be used if available. When using this option, no reprojection of features from the SRS of the input vector to the specified SRS of the output raster, so use only this option to correct an invalid source SRS. The <srs_def> may be any of the usual GDAL/OGR forms, complete WKT, PROJ.4, EPSG:n or a file containing the WKT.
148+
Override the projection for the output file. If not specified, the projection of the input vector file will be used if available. When using this option, no reprojection of features from the CRS of the input vector to the specified CRS of the output raster, so use only this option to correct an invalid source CRS. The ``<CRS>`` may be any of the usual GDAL/OGR forms, complete WKT, PROJ.4, EPSG:n or a file containing the WKT.
150149

151150
.. option:: --transformer-option <NAME>=<VALUE>
152151

@@ -158,19 +157,19 @@ Standard options
158157

159158
.. option:: --resolution <xres>,<yres>
160159

161-
Set target resolution. The values must be expressed in georeferenced units. Both must be positive values. Note that `--target-resolution` cannot be used with `--target-size`.
160+
Set target resolution. The values must be expressed in georeferenced units. Both must be positive values. Note that `--resolution` cannot be used with `--size`.
162161

163162
.. option:: --target-aligned-pixels
164163

165164
(target aligned pixels) Align the coordinates of the extent of the output file to the values of the -tr, such that the aligned extent includes the minimum extent. Alignment means that xmin / resx, ymin / resy, xmax / resx and ymax / resy are integer values.
166165

167166
.. option:: --size <xsize>,<ysize>
168167

169-
Set output file size in pixels and lines. Note that `--target-size` cannot be used with `--target-resolution`.
168+
Set output file size in pixels and lines. Note that `--size` cannot be used with `--resolution`.
170169

171170
.. option:: --ot, --datatype, --output-data-type <OUTPUT-DATA-TYPE>
172171

173-
Force the output bands to be of the indicated data type. Defaults to `Float64`, unless the attribute field to burn is of type `Int6`4, in which case `Int64`` is used for the output raster data type if the output driver supports it.
172+
Force the output bands to be of the indicated data type. Defaults to ``Float64``, unless the attribute field to burn is of type ``Int64``, in which case ``Int64`` is used for the output raster data type if the output driver supports it.
174173

175174
.. option:: --optimization <OPTIMIZATION>
176175

@@ -211,4 +210,4 @@ Examples
211210

212211
.. code-block:: bash
213212
214-
gdal vector rasterize --burn 255,0,0 --ot Byte --size 1000,1000 -l footprints footprints.shp mask.tif
213+
gdal vector rasterize --burn 255,0,0 --ot Byte --size 1000,1000 -l footprints footprints.shp mask.tif

doc/source/programs/gdal_vector_sql.rst

+1-25
Original file line numberDiff line numberDiff line change
@@ -73,31 +73,7 @@ Standard options
7373
Can be repeated to generated multiple output layers (repeating --sql <value>
7474
for each output layer)
7575

76-
.. option:: --dialect <DIALECT>
77-
78-
SQL dialect.
79-
80-
By default the native SQL of an RDBMS is used when using
81-
``gdal vector sql``. If using ``sql`` as a step of ``gdal vector pipeline``,
82-
this is only true if the step preceding ``sql`` is ``read``, otherwise the
83-
:ref:`OGRSQL <ogr_sql_dialect>` dialect is used.
84-
85-
If a datasource does not support SQL natively, the default is to use the
86-
``OGRSQL`` dialect, which can also be specified with any data source.
87-
88-
The :ref:`sql_sqlite_dialect` dialect can be chosen with the ``SQLITE``
89-
and ``INDIRECT_SQLITE`` dialect values, and this can be used with any data source.
90-
Overriding the default dialect may be beneficial because the capabilities of
91-
the SQL dialects vary. What SQL dialects a driver supports can be checked
92-
with "gdal vector info".
93-
94-
.. code-block::
95-
96-
$ gdal vector info --format "PostgreSQL"
97-
Supported SQL dialects: NATIVE OGRSQL SQLITE
98-
99-
$ gdal vector info --format "ESRI Shapefile"
100-
Supported SQL dialects: OGRSQL SQLITE
76+
.. include:: gdal_options/sql_dialect.rst
10177

10278

10379
.. option:: --output-layer <OUTPUT-LAYER>

0 commit comments

Comments
 (0)