gdaltindex: restore -ot option accidentally removed in GDAL 3.10.0

Fixes #11246

This option was new of GDAL 3.9 for GTI tile indices.
Workaround: ``-mo DATA_TYPE=<datatype>``
This commit is contained in:
Even Rouault 2024-11-11 20:55:28 +01:00
parent 6b9549ea7a
commit 8dd92ad68b
No known key found for this signature in database
GPG Key ID: 33EBBFC47B3DD87D
2 changed files with 21 additions and 0 deletions

View File

@ -275,6 +275,11 @@ static std::unique_ptr<GDALArgumentParser> GDALTileIndexAppOptionsGetParser(
.scan<'g', double>()
.help(_("Set target extent in SRS unit."));
argParser->add_argument("-ot")
.metavar("<datatype>")
.store_into(psOptions->osDataType)
.help(_("Output data type."));
argParser->add_argument("-bandcount")
.metavar("<val>")
.store_into(psOptions->osBandCount)

View File

@ -443,3 +443,19 @@ def test_gdaltindex_lib_fetch_md(tmp_path, four_tiles):
lyr = ds.GetLayer(0)
f = lyr.GetNextFeature()
assert f["foo_field"] == "bar"
###############################################################################
# Test -ot
@pytest.mark.require_driver("GPKG")
def test_gdaltindex_lib_ot(tmp_path, four_tiles):
index_filename = str(tmp_path / "test_gdaltindex_lib_ot.gpkg")
gdal.TileIndex(index_filename, four_tiles[0], options="-ot UInt16")
ds = ogr.Open(index_filename)
lyr = ds.GetLayer(0)
assert lyr.GetMetadataItem("DATA_TYPE") == "UInt16"