<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html;
      charset=windows-1252">
  </head>
  <body>
    <p>Joaquim,</p>
    <p>yes, you should be able to use a /vsimem/ file as a cutline
      dataset. Here's an example in Python with a shapefile in /vsimem/:</p>
    <p><a class="moz-txt-link-freetext" href="https://github.com/OSGeo/gdal/blob/fec15b146f8a750c23c5e765cac12ed5fc9c2b85/autotest/utilities/test_gdalwarp_lib.py#L1103">https://github.com/OSGeo/gdal/blob/fec15b146f8a750c23c5e765cac12ed5fc9c2b85/autotest/utilities/test_gdalwarp_lib.py#L1103</a></p>
    <p>The <span class="pl-s1">cutlineDSName</span><span class="pl-c1">=</span><span
        class="pl-s"> is just python syntaxic sugar to format the
        arguments. There's no reason it shouldn't work in Julia too</span></p>
    <p><span class="pl-s">Make sure that the cutline dataset is properly
        closed, before using it with gdalwarp</span></p>
    <p><span class="pl-s">Even<br>
      </span></p>
    Le 31/03/2021 à 15:34, Joaquim Manuel Freire Luís a écrit :<br>
    <blockquote type="cite"
cite="mid:AM6PR04MB3959889ECC098A47359C6A4EA67C9@AM6PR04MB3959.eurprd04.prod.outlook.com">
      <meta name="Generator" content="Microsoft Word 15 (filtered
        medium)">
      <div class="WordSection1">
        <p class="MsoNormal"><span lang="EN-US">I have low hopes on this
            one but have to confirm.</span></p>
        <p class="MsoNormal"><span lang="EN-US"> </span></p>
        <p class="MsoNormal"><span lang="EN-US">I have this “ds” dataset
            with one polygon geometry, which is correctly saved on disk
            with</span></p>
        <p class="MsoNormal"><span lang="EN-US"> </span></p>
        <p class="MsoNormal"><span lang="EN-US">ogr2ogr(ds,
            save="lixo.gmt")</span></p>
        <p class="MsoNormal"><span lang="EN-US"> </span></p>
        <p class="MsoNormal"><span lang="EN-US">and later correctly
            “cutlines” with</span></p>
        <p class="MsoNormal"><span lang="EN-US"> </span></p>
        <p class="MsoNormal"><span lang="EN-US">gdalwarp("IMG_9106.jpg",
            ["-cutline", "lixo.gmt", "-to",
            "SRC_METHOD=NO_GEOTRANSFORM"]);</span></p>
        <p class="MsoNormal"><span lang="EN-US"> </span></p>
        <p class="MsoNormal"><span lang="EN-US">but I wanted to avoid
            the step of saving to disk and instead using the inMemory
            file. If I ask its name, I see</span></p>
        <p class="MsoNormal"><span lang="EN-US"> </span></p>
        <p class="MsoNormal"><span lang="EN-US">GDALGetDescription(ds.ptr)</span></p>
        <p class="MsoNormal"><span lang="EN-US">"/vsimem/##258"</span></p>
        <p class="MsoNormal"><span lang="EN-US"> </span></p>
        <p class="MsoNormal"><span lang="EN-US">But this fails</span></p>
        <p class="MsoNormal"><span lang="EN-US"> </span></p>
        <p class="MsoNormal"><span lang="EN-US">gdalwarp("IMG_9106.jpg",
            ["-cutline", GDALGetDescription(ds.ptr), "-to",
            "SRC_METHOD=NO_GEOTRANSFORM"])</span></p>
        <p class="MsoNormal"><span lang="EN-US">NULL Dataset</span></p>
        <p class="MsoNormal"><span lang="EN-US"> </span></p>
        <p class="MsoNormal"><span lang="EN-US">Can this be made to work
            (would it work with the python bindings?) and I’m just doing
            it wrong or it just can’t?</span></p>
        <p class="MsoNormal"><span lang="EN-US"> </span></p>
        <p class="MsoNormal"><span lang="EN-US">Thanks</span></p>
        <p class="MsoNormal"><span lang="EN-US"> </span></p>
        <p class="MsoNormal"><span lang="EN-US">Joaquim</span></p>
        <p class="MsoNormal"><span lang="EN-US"> </span></p>
        <p class="MsoNormal"><span lang="EN-US"> </span></p>
      </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>