<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>Thomas,</p>
    <p>part of the unexposed options are indeed due to:</p>
    <p>- sometimes desynchronization between the C++ and Python API</p>
    <p>- sometimes not finding quickly a good enough Python name, and
      the option being of marginal use</p>
    <p>- or because the handling of the switch must be done when
      opening/creating the input/output dataset and, as gdal.Warp() can
      accept dataset objects in addition to filenames, the option would
      be without effect. If you look at apps/gdalwarp_lib.cpp in the
      GDALWarpAppOptionsNew() function, all switches that have only the
      effect of setting a field of the psOptionsForBinary structure
      aren't good candidates to be mapped as kwargsoptions. -overwrite
      is in this category (if you pass an output dataset *object*)<br>
    </p>
    <p>Regarding -rb, -rc, -rcs they are historical shortcurs for -r
      bilinear, -r cubic, -r cubicspline that have been undocumented for
      phasing them out as we have now a bunch of methods compared to the
      few ones of older versions.</p>
    <p>Even<br>
    </p>
    <div class="moz-cite-prefix">Le 31/05/2021 à 22:50, Thomas Gratier a
      écrit :<br>
    </div>
    <blockquote type="cite"
cite="mid:CACPZzQ15BS8YHJ1xs+s0Rw-s4y_EVSAvGCKASF5YqhVbS+TjSQ@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div dir="ltr">
        <div>Hello all,</div>
        <div><br>
        </div>
        <div>Due to question at <a
href="https://gis.stackexchange.com/questions/398223/how-to-remap-gdal-options-from-string-version-to-a-dictionary-version"
            moz-do-not-send="true">https://gis.stackexchange.com/questions/398223/how-to-remap-gdal-options-from-string-version-to-a-dictionary-version</a></div>
        <div>I've taken a look at code<br>
        </div>
        <div><br>
        </div>
        <div>When trying to use gdal.Warp from Python, most options are
          supported but some seems to be missing</div>
        <div>Although an approach with only `gdal.Warp(dest, origin,
          options='-overwrite')` can work without code change,<br>
          the dict approach like below seems to be simpler from a Python
          perspective<br>
          <br>
          kwargsoptions = {"overwrite": True} # particular key does not
          exist, just for the explanation<br>
          gdal.Warp(dest, origin, **kwargsoptions)<br>
          <br>
          Below are the command options I only found in gdalwarp command
          line but absent in the WarpOptions (from doc <a
            href="https://gdal.org/programs/gdalwarp.html#cmdoption-gdalwarp-r"
            moz-do-not-send="true">https://gdal.org/programs/gdalwarp.html#cmdoption-gdalwarp-r</a>)<br>
          <br>
          [-ct string]<br>
          [-novshiftgrid]<br>
          [-refine_gcps tolerance [minimum_gcps]]<br>
          [-ovr level|AUTO|AUTO-n|NONE]<br>
          [-srcalpha|-nosrcalpha]<br>
          [-q]<br>
          [-if format]*<br>
          [-overwrite]<br>
          [-oo NAME=VALUE]*<br>
          [-doo NAME=VALUE]*<br>
          <br>
          -srcalpha is present but not it counterpart -nosrcalpha<br>
          <br>
          In gdal.py code, there are references to resampling option not
          in the doc e.g below excerpt<br>
          (from <a
href="https://github.com/OSGeo/gdal/blob/master/gdal/swig/python/osgeo/gdal.py#L588"
            moz-do-not-send="true">https://github.com/OSGeo/gdal/blob/master/gdal/swig/python/osgeo/gdal.py#L588</a>)
          .<br>
          <br>
          elif resampleAlg == GRIORA_Bilinear:<br>
              new_options += ['-rb']<br>
          elif resampleAlg == GRIORA_Cubic:<br>
              new_options += ['-rc']<br>
          elif resampleAlg == GRIORA_CubicSpline:<br>
              new_options += ['-rcs']<br>
          <br>
          It may to need to be removed if looking at <a
            href="https://gdal.org/programs/gdalwarp.html#cmdoption-gdalwarp-r"
            moz-do-not-send="true">https://gdal.org/programs/gdalwarp.html#cmdoption-gdalwarp-r</a><br>
          e.g (no -rcs, -rb or -rc options) except maybe for
          compatibility reason<br>
          <br>
          I will try to make a PR. The main issue is more about naming
          for each option.<br>
          I also don't know if command line and Python API "unsync" is
          due to evolution, to intended API choices or other reasons.<br>
          <br>
          I also only discuss here the gdal.Warp options but I suppose
          there are maybe other Python tools ported from RFC 59<br>
          <a
href="https://gdal.org/development/rfc/rfc59_utilities_as_a_library.html"
            moz-do-not-send="true">https://gdal.org/development/rfc/rfc59_utilities_as_a_library.html</a>
          that may have the same "unsync" issue.</div>
        <div>Did not look at the moment<br>
          <br>
          <br>
          Regards<br>
          <br>
          Thomas Gratier<br>
        </div>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <pre class="moz-quote-pre" wrap="">_______________________________________________
gdal-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a>
<a class="moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/gdal-dev">https://lists.osgeo.org/mailman/listinfo/gdal-dev</a>
</pre>
    </blockquote>
    <pre class="moz-signature" cols="72">-- 
<a class="moz-txt-link-freetext" href="http://www.spatialys.com">http://www.spatialys.com</a>
My software is free, but my time generally not.</pre>
  </body>
</html>