Skip to content

Commit

Permalink
Merge pull request #11247 from rouault/fix_11246
Browse files Browse the repository at this point in the history
gdaltindex: restore -ot option accidentally removed in GDAL 3.10.0
  • Loading branch information
rouault authored Nov 13, 2024
2 parents f2c7ec4 + 8dd92ad commit 387b4df
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 387b4df

Please sign in to comment.