Skip to content

Commit

Permalink
Merge pull request #10936 from OSGeo/backport-10921-to-release/3.9
Browse files Browse the repository at this point in the history
[Backport release/3.9] Python bindings: fix passing a dict value to the transformerOptions argument of gdal.Warp()
  • Loading branch information
rouault authored Oct 5, 2024
2 parents 6a8047d + 6d74839 commit d787565
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion autotest/utilities/test_gdalwarp_lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -1830,7 +1830,10 @@ def test_gdalwarp_lib_134(tmp_vsimem):
"",
src_ds,
format="MEM",
transformerOptions=["SRC_METHOD=NO_GEOTRANSFORM", "DST_METHOD=NO_GEOTRANSFORM"],
transformerOptions={
"SRC_METHOD": "NO_GEOTRANSFORM",
"DST_METHOD": "NO_GEOTRANSFORM",
},
outputBounds=[1, 2, 4, 6],
)
assert ds is not None
Expand Down
2 changes: 1 addition & 1 deletion swig/include/python/gdal_python.i
Original file line number Diff line number Diff line change
Expand Up @@ -2839,7 +2839,7 @@ def WarpOptions(options=None, format=None,
if transformerOptions is not None:
if isinstance(transformerOptions, dict):
for k, v in transformerOptions.items():
new_options += ['-to', opt]
new_options += ['-to', f'{k}={v}']
else:
for opt in transformerOptions:
new_options += ['-to', opt]
Expand Down

0 comments on commit d787565

Please sign in to comment.