Skip to content

Commit

Permalink
gdaltindex: restore -ot option accidentally removed in GDAL 3.10.0
Browse files Browse the repository at this point in the history
Fixes #11246

This option was new of GDAL 3.9 for GTI tile indices.
Workaround: ``-mo DATA_TYPE=<datatype>``
  • Loading branch information
rouault authored and github-actions[bot] committed Nov 13, 2024
1 parent 6fbd50e commit 96f368e
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
5 changes: 5 additions & 0 deletions apps/gdaltindex_lib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
16 changes: 16 additions & 0 deletions autotest/utilities/test_gdaltindex_lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"

0 comments on commit 96f368e

Please sign in to comment.