<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Aptos;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
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;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0in;
        font-size:10.0pt;
        font-family:"Courier New";}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:Consolas;
        mso-ligatures:standardcontextual;}
span.EmailStyle22
        {mso-style-type:personal-reply;
        font-family:"Aptos",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;
        mso-ligatures:none;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
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]-->
</head>
<body lang="EN-US" link="#467886" vlink="purple" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal">Right. But I do that I get another error that I’m not sure how to interpret. It comes from some Julia internal<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">ccall((:GDALGetRasterCount, libgdal), Cint, (Ptr{Cvoid},), ds)<o:p></o:p></p>
<p class="MsoNormal">Internal Error: MethodError: no method matching unsafe_convert(::Type{Ptr{Nothing}}, ::GMT.Gdal.IDataset)<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-family:"Calibri",sans-serif;mso-ligatures:none">From:</span></b><span style="font-family:"Calibri",sans-serif;mso-ligatures:none"> Even Rouault <even.rouault@spatialys.com>
<br>
<b>Sent:</b> Monday, May 12, 2025 12:15 AM<br>
<b>To:</b> Joaquim Manuel Freire Luís <jluis@ualg.pt>; gdal-dev <gdal-dev@lists.osgeo.org><br>
<b>Subject:</b> Re: [gdal-dev] GDAL 3.11 broke part of the Julia wrapper<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p><o:p> </o:p></p>
<div>
<p class="MsoNormal">Le 12/05/2025 à 01:04, Joaquim Manuel Freire Luís via gdal-dev a écrit :<o:p></o:p></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal"><span lang="PT">Hi,</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="PT"> </span><o:p></o:p></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">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.<o:p></o:p></p>
</blockquote>
<p>Why is GDALDatasetGetLayerCount() == 0 wrong on a raster dataset ? It looks like the expected result<o:p></o:p></p>
<p>If I'm looking at the correct source code <a 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.<o:p></o:p></p>
<pre>-- <o:p></o:p></pre>
<pre><a href="http://www.spatialys.com">http://www.spatialys.com</a><o:p></o:p></pre>
<pre>My software is free, but my time generally not.<o:p></o:p></pre>
</div>
</body>
</html>