Skip to content

Commit 6ac8a29

Browse files
committed
gdalinfo: support again -wkt_format WKT1_ESRI
Fixes #13906
1 parent 7877247 commit 6ac8a29

File tree

3 files changed

+25
-3
lines changed

3 files changed

+25
-3
lines changed

apps/gdalinfo_lib.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -298,8 +298,9 @@ GDALInfoAppOptionsGetParser(GDALInfoOptions *psOptions,
298298
"system."));
299299

300300
argParser->add_argument("-wkt_format")
301-
.metavar("<WKT1|WKT2|WKT2_2015|WKT2_2018|WKT2_2019>")
302-
.choices("WKT1", "WKT2", "WKT2_2015", "WKT2_2018", "WKT2_2019")
301+
.metavar("<WKT1|WKT1_ESRI|WKT2|WKT2_2015|WKT2_2018|WKT2_2019>")
302+
.choices("WKT1", "WKT1_ESRI", "WKT2", "WKT2_2015", "WKT2_2018",
303+
"WKT2_2019")
303304
.store_into(psOptions->osWKTFormat)
304305
.help(_("WKT format used for SRS."));
305306

autotest/utilities/test_gdalinfo_lib.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,3 +375,22 @@ def test_gdalinfo_lib_no_driver():
375375
assert ds2.GetDriver() is None
376376
gdal.Info(ds2)
377377
gdal.Info(ds2, format="json")
378+
379+
380+
###############################################################################
381+
# Test fix for https://github.com/OSGeo/gdal/issues/13906
382+
383+
384+
@pytest.mark.parametrize(
385+
"wkt_format,expected",
386+
[
387+
("WKT1", """PROJCS["NAD27 / UTM zone 11N","""),
388+
("WKT1_ESRI", """PROJCS["NAD_1927_UTM_Zone_11N","""),
389+
("WKT2", """PROJCRS["NAD27 / UTM zone 11N","""),
390+
],
391+
)
392+
def test_gdalinfo_lib_wkt_format(wkt_format, expected):
393+
394+
ds = gdal.Open("../gcore/data/byte.tif")
395+
ret = gdal.Info(ds, options="-json -wkt_format " + wkt_format)
396+
assert ret["coordinateSystem"]["wkt"].startswith(expected)

doc/source/programs/gdalinfo.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,13 +114,15 @@ The following command line parameters can appear in any order
114114

115115
Only display the first file of the file list.
116116

117-
.. option:: -wkt_format WKT1|WKT2|WKT2_2015|WKT2_2018|WKT2_2019
117+
.. option:: -wkt_format WKT1|WKT1_ESRI|WKT2|WKT2_2015|WKT2_2018|WKT2_2019
118118

119119
WKT format used to display the SRS.
120120
Currently the supported values are:
121121

122122
``WKT1``
123123

124+
``WKT1_ESRI``
125+
124126
``WKT2`` (latest WKT version, currently *WKT2_2019*)
125127

126128
``WKT2_2015``

0 commit comments

Comments
 (0)