gdal: fix ternary conditionals

Closes #19364.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>