Sorry, forgot to pass the pointer. Also here it says the layer count is zero
ccall((:GDALDatasetGetLayerCount, libgdal), Cint, (Ptr{Cvoid},), ds.ptr) 0 From: gdal-dev <gdal-dev-boun...@lists.osgeo.org> On Behalf Of Joaquim Manuel Freire Luís via gdal-dev Sent: Monday, May 12, 2025 12:34 AM To: Even Rouault <even.roua...@spatialys.com>; gdal-dev <gdal-dev@lists.osgeo.org> Subject: Re: [gdal-dev] GDAL 3.11 broke part of the Julia wrapper 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.roua...@spatialys.com<mailto:even.roua...@spatialys.com>> Sent: Monday, May 12, 2025 12:15 AM To: Joaquim Manuel Freire Luís <jl...@ualg.pt<mailto:jl...@ualg.pt>>; gdal-dev <gdal-dev@lists.osgeo.org<mailto:gdal-dev@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.
_______________________________________________ gdal-dev mailing list gdal-dev@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/gdal-dev