<div dir="ltr"><div>Hi Naima</div><div><br></div><div>I have been testing with your dataset. To me, using the GDAL in Ubuntu 22.04 (3.4.1) seems to be a problem with the JP2 output format. If you output as geotiff it works fine.<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, 5 Nov 2023 at 19:43, Rahkonen Jukka via gdal-dev <<a href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="msg-3848317706079080660">
<div lang="FI" style="overflow-wrap: break-word;">
<div class="m_-3848317706079080660WordSection1">
<p class="MsoNormal"><span>Hi,<u></u><u></u></span></p>
<p class="MsoNormal"><span><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">Please add gdalinfo of the source image. Even better if you can share the image.<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">-Jukka Rahkonen-<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
<div style="border-width:1pt medium medium;border-style:solid none none;border-color:rgb(225,225,225) currentcolor currentcolor;padding:3pt 0cm 0cm">
<p class="MsoNormal"><b>Lähettäjä:</b> gdal-dev <<a href="mailto:gdal-dev-bounces@lists.osgeo.org" target="_blank">gdal-dev-bounces@lists.osgeo.org</a>>
<b>Puolesta </b>Naima Dambrine via gdal-dev<br>
<b>Lähetetty:</b> sunnuntai 5. marraskuuta 2023 17.35<br>
<b>Vastaanottaja:</b> <a href="mailto:gdal-dev@lists.osgeo.org" target="_blank">gdal-dev@lists.osgeo.org</a><br>
<b>Aihe:</b> [gdal-dev] oblique cuts on a raster using python GDAL<u></u><u></u></p>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<div>
<p class="MsoNormal"><span style="font-size:12pt;font-family:"Avenir-Book",serif;color:black">Hi ,<u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12pt;font-family:"Avenir-Book",serif;color:black"><u></u> <u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:13.5pt;font-family:"Avenir-Book",serif;color:black">I have problems with oblique cuts on a raster using python GDAL (3.6.2)</span><span style="font-size:12pt;font-family:"Avenir-Book",serif;color:black"><u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12pt;font-family:"Avenir-Book",serif;color:black"><u></u> <u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:13.5pt;font-family:"Avenir-Book",serif;color:black">- with this line i obtain black borders around :</span><span style="font-size:12pt;font-family:"Avenir-Book",serif;color:black"><u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:13.5pt;font-family:"Avenir-Book",serif;color:black">gdal.warp('raster-dst' , raster-src', cutLineDSName='geometry-extraction.shp', cropToCutline=True)</span><span style="font-size:12pt;font-family:"Avenir-Book",serif;color:black"><u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:"Avenir-Book",serif;color:black"><u></u> <u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12pt;font-family:"Avenir-Book",serif;color:black">- with this one, </span><span style="font-size:13.5pt;font-family:"Avenir-Book",serif;color:black">the crop is not clean on closer inspection: residual black pixels
around image and white pixels appear in the image.</span><span style="font-family:"Avenir-Book",serif;color:black"><u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:13.5pt;font-family:"Avenir-Book",serif;color:black">gdal. warp( 'raster-dst' , raster-src', cutLineDSName='geometry-extraction.shp', cropToCutline=True, copyMetaData=True, dstNodata=0)</span><span style="font-family:"Avenir-Book",serif;color:black"><u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12pt"><span style="font-family:"Avenir-Book",serif;color:black"><br>
</span><span style="font-size:13.5pt;font-family:"Avenir-Book",serif;color:black">I tried, without success, to refine with outputBounds=[minX, maxX, minY, maxY], under QGIS directly …. </span><span style="font-family:"Avenir-Book",serif;color:black"><br>
</span><span style="font-size:13.5pt;font-family:"Avenir-Book",serif;color:black">I've run out of ideas :/ </span><span style="font-family:"Avenir-Book",serif;color:black"><br>
</span><span style="font-size:13.5pt;font-family:"Avenir-Book",serif;color:black">A (naive) question comes to mind: Is it possible to make oblique cuts with gdal.warp() & co?</span><span style="font-family:"Avenir-Book",serif;color:black"><u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12pt;font-family:"Avenir-Book",serif;color:black">Naïma<u></u><u></u></span></p>
</div>
</div>
</div>
</div>
_______________________________________________<br>
gdal-dev mailing list<br>
<a href="mailto:gdal-dev@lists.osgeo.org" target="_blank">gdal-dev@lists.osgeo.org</a><br>
<a href="https://lists.osgeo.org/mailman/listinfo/gdal-dev" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/gdal-dev</a><br>
</div></blockquote></div>