[gdal-dev] GDAL 3.11 broke part of the Julia wrapper
Joaquim Manuel Freire Luís
jluis at ualg.pt
Sun May 11 16:33:32 PDT 2025
Right. But I do that I get another error that I’m not sure how to interpret. It comes from some Julia internal
ccall((:GDALGetRasterCount, libgdal), Cint, (Ptr{Cvoid},), ds)
Internal Error: MethodError: no method matching unsafe_convert(::Type{Ptr{Nothing}}, ::GMT.Gdal.IDataset)
From: Even Rouault <even.rouault at spatialys.com>
Sent: Monday, May 12, 2025 12:15 AM
To: Joaquim Manuel Freire Luís <jluis at ualg.pt>; gdal-dev <gdal-dev at lists.osgeo.org>
Subject: Re: [gdal-dev] GDAL 3.11 broke part of the Julia wrapper
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/20250511/bd02365f/attachment.htm>
More information about the gdal-dev
mailing list