[gdal-dev] GDAL 3.11 broke part of the Julia wrapper

Even Rouault even.rouault at spatialys.com
Sun May 11 16:15:22 PDT 2025


Le 12/05/2025 à 01:04, Joaquim Manuel Freire Luís via gdal-dev a écrit :
>
> Hi,
>
> 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 
> https://github.com/OSGeo/gdal/pull/12124 (which is a very big PR) 
> broke my Julia wrapper.
>
> For example, this used to write a png image but now it errors with
>
> julia> gdalwrite("lixo.png", mat2img(UInt8.([1 2 3; 4 5 6; 7 8 9])))
>
> ERROR 1: Cannot guess driver for lixo.png
>
> But maybe more concrete is this failure where it tries to extract info 
> from a gdal dataset (a pointer )
>
>
> Gdal.GDALGetRasterYSize(dataset.ptr)
>
> 49
>
> Gdal.GDALGetRasterCount(dataset.ptr)
>
> 1
>
> Gdal.GDALDatasetGetLayerCount(dataset.ptr)
>
> 0
>
> Here, first two are correct be the third is now wrong.
>
Why is GDALDatasetGetLayerCount() == 0 wrong on a raster dataset ? It 
looks like the expected result

If I'm looking at the correct source code 
https://github.com/GenericMappingTools/GMT.jl/blob/94649db2b48d3223c8b8628b6fac4d3df60b8938/src/gdal_utils.jl#L859 
, 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.

-- 
http://www.spatialys.com
My software is free, but my time generally not.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20250512/de2f0453/attachment-0001.htm>


More information about the gdal-dev mailing list