<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p><br>
    </p>
    <div class="moz-cite-prefix">Le 12/05/2025 à 01:04, Joaquim Manuel
      Freire Luís via gdal-dev a écrit :<br>
    </div>
    <blockquote type="cite"
cite="mid:AM6PR04MB6440581BDF29BCED52E44FD7A694A@AM6PR04MB6440.eurprd04.prod.outlook.com">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <meta name="Generator"
        content="Microsoft Word 15 (filtered medium)">
      <style>@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}@font-face
        {font-family:Aptos;}p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        font-size:11.0pt;
        font-family:"Aptos",sans-serif;
        mso-ligatures:standardcontextual;}a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#467886;
        text-decoration:underline;}span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Aptos",sans-serif;
        color:windowtext;}.MsoChpDefault
        {mso-style-type:export-only;
        font-size:11.0pt;}div.WordSection1
        {page:WordSection1;}</style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
      <div class="WordSection1">
        <p class="MsoNormal"><span lang="PT">Hi,<o:p></o:p></span></p>
        <p class="MsoNormal"><span lang="PT"><o:p> </o:p></span></p>
        <p class="MsoNormal">I’m afraid this one is not going to be
          easy, and I don’t know how much help I can provide to find the
          issue. The think is that
          <a href="https://github.com/OSGeo/gdal/pull/12124"
            moz-do-not-send="true" class="moz-txt-link-freetext">https://github.com/OSGeo/gdal/pull/12124</a>
          (which is a very big PR) broke my Julia wrapper.<o:p></o:p></p>
        <p class="MsoNormal"><o:p> </o:p></p>
        <p class="MsoNormal">For example, this used to write a png image
          but now it errors with<o:p></o:p></p>
        <p class="MsoNormal"><o:p> </o:p></p>
        <p class="MsoNormal">julia> gdalwrite("lixo.png",
          mat2img(UInt8.([1 2 3; 4 5 6; 7 8 9])))<o:p></o:p></p>
        <p class="MsoNormal">ERROR 1: Cannot guess driver for lixo.png<o:p></o:p></p>
        <p class="MsoNormal"><o:p> </o:p></p>
        <p class="MsoNormal">But maybe more concrete is this failure
          where it tries to extract info from a gdal dataset (a pointer
          )<o:p></o:p></p>
        <p class="MsoNormal"><o:p> </o:p></p>
        <p class="MsoNormal"><br>
          Gdal.GDALGetRasterYSize(dataset.ptr)<o:p></o:p></p>
        <p class="MsoNormal">49<o:p></o:p></p>
        <p class="MsoNormal">Gdal.GDALGetRasterCount(dataset.ptr)<o:p></o:p></p>
        <p class="MsoNormal">1<o:p></o:p></p>
        <p class="MsoNormal">Gdal.GDALDatasetGetLayerCount(dataset.ptr)<o:p></o:p></p>
        <p class="MsoNormal">0<o:p></o:p></p>
        <p class="MsoNormal"><o:p> </o:p></p>
        <p class="MsoNormal">Here, first two are correct be the third is
          now wrong.</p>
      </div>
    </blockquote>
    <p>Why is GDALDatasetGetLayerCount() == 0 wrong on a raster dataset
      ? It looks like the expected result</p>
    <p>If I'm looking at the correct source code
<a class="moz-txt-link-freetext" href="https://github.com/GenericMappingTools/GMT.jl/blob/94649db2b48d3223c8b8628b6fac4d3df60b8938/src/gdal_utils.jl#L859">https://github.com/GenericMappingTools/GMT.jl/blob/94649db2b48d3223c8b8628b6fac4d3df60b8938/src/gdal_utils.jl#L859</a>
      , then this line is fragile. Rather than testing if
      OGRGetDriverByName() returns a non null pointer to guess if that
      dataset is raster or vector, you could indeed test
      GDALGetRasterCount() != 0 to infer this is a raster dataset.</p>
    <span style="white-space: pre-wrap">
</span>
    <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>