rafaqz / Rasters.jl

Raster manipulation for the Julia language
MIT License
197 stars 34 forks source link

Conversion to pointer not defined for ArchGDAL.IRasterBand #679

Open asinghvi17 opened 3 weeks ago

asinghvi17 commented 3 weeks ago

https://github.com/MakieOrg/GeoMakie.jl/actions/runs/9416699971/job/25940377394#step:8:60

Stacktrace is:

ras = Raster(EarthEnv{HabitatHeterogeneity}, :homogeneity)
│ 
│   exception =
│    conversion to pointer not defined for ArchGDAL.IRasterBand{UInt16}
│    Stacktrace:
│      [1] error(s::String)
│        @ Base ./error.jl:35
│      [2] unsafe_convert(::Type{Ptr{UInt16}}, a::ArchGDAL.IRasterBand{UInt16})
│        @ Base ./pointer.jl:67
│      [3] unsafe_convert(::Type{Ptr{Nothing}}, a::ArchGDAL.IRasterBand{UInt16})
│        @ Base ./pointer.jl:66
│      [4] gdalgetrasternodatavalue(arg1::ArchGDAL.IRasterBand{UInt16}, arg2::Base.RefValue{Int32})
│        @ GDAL ~/.julia/packages/GDAL/hNyuz/src/libgdal.jl:9666
│      [5] missingval(::ArchGDAL.RasterDataset{UInt16, ArchGDAL.Dataset})
│        @ RastersArchGDALExt ~/.julia/packages/Rasters/3wmT2/ext/RastersArchGDALExt/gdal_source.jl:267
│      [6] _fix_missingval(A::ArchGDAL.RasterDataset{UInt16, ArchGDAL.Dataset}, ::Rasters.NoKW)
│        @ Rasters ~/.julia/packages/Rasters/3wmT2/src/array.jl:336
│      [7] (::Rasters.var"#53#54"{Rasters.NoKW, Rasters.NoKW, Rasters.NoKW, Rasters.NoKW, Rasters.NoKW, Rasters.NoKW, Rasters.GDALsource, Bool, Bool, Bool, String, Symbol})(var::ArchGDAL.RasterDataset{UInt16, ArchGDAL.Dataset})
│        @ Rasters ~/.julia/packages/Rasters/3wmT2/src/array.jl:315
│      [8] _open(f::Rasters.var"#53#54"{Rasters.NoKW, Rasters.NoKW, Rasters.NoKW, Rasters.NoKW, Rasters.NoKW, Rasters.NoKW, Rasters.GDALsource, Bool, Bool, Bool, String, Symbol}, ::Rasters.GDALsource, ds::ArchGDAL.RasterDataset{UInt16, ArchGDAL.Dataset}; kw::@Kwargs{name::Symbol, group::Rasters.NoKW})
│        @ RastersArchGDALExt ~/.julia/packages/Rasters/3wmT2/ext/RastersArchGDALExt/gdal_source.jl:117
│      [9] Rasters.Raster(ds::ArchGDAL.RasterDataset{UInt16, ArchGDAL.Dataset}, filename::String; dims::Rasters.NoKW, refdims::Tuple{}, name::Symbol, group::Rasters.NoKW, metadata::Rasters.NoKW, missingval::Rasters.NoKW, crs::Rasters.NoKW, mappedcrs::Rasters.NoKW, source::Rasters.GDALsource, replace_missing::Bool, write::Bool, lazy::Bool, dropband::Bool)
│        @ Rasters ~/.julia/packages/Rasters/3wmT2/src/array.jl:313
│     [10] (::Rasters.var"#50#51"{Rasters.GDALsource, @Kwargs{name::Symbol, crs::Rasters.NoKW}, String})(ds::ArchGDAL.RasterDataset{UInt16, ArchGDAL.Dataset})
│        @ Rasters ~/.julia/packages/Rasters/3wmT2/src/array.jl:293
│     [11] call_composed(fs::Tuple{Rasters.var"#50#51"{Rasters.GDALsource, @Kwargs{name::Symbol, crs::Rasters.NoKW}, String}}, x::Tuple{ArchGDAL.RasterDataset{UInt16, ArchGDAL.Dataset}}, kw::@Kwargs{})
│        @ Base ./operators.jl:1045
│     [12] call_composed
│        @ ./operators.jl:1044 [inlined]
│     [13] (::ComposedFunction{typeof(Rasters.cleanreturn), Rasters.var"#50#51"{Rasters.GDALsource, @Kwargs{name::Symbol, crs::Rasters.NoKW}, String}})(x::ArchGDAL.RasterDataset{UInt16, ArchGDAL.Dataset}; kw::@Kwargs{})
│        @ Base ./operators.jl:1041
│     [14] readraster(f::ComposedFunction{typeof(Rasters.cleanreturn), Rasters.var"#50#51"{Rasters.GDALsource, @Kwargs{name::Symbol, crs::Rasters.NoKW}, String}}, args::String; kwargs::@Kwargs{})
│        @ ArchGDAL ~/.julia/packages/ArchGDAL/AZONk/src/context.jl:267
│     [15] readraster(f::Function, args::String)
│        @ ArchGDAL ~/.julia/packages/ArchGDAL/AZONk/src/context.jl:2[64](https://github.com/MakieOrg/GeoMakie.jl/actions/runs/9416699971/job/25940377394#step:8:65)
│     [16] _open(f::Function, ::Rasters.GDALsource, filename::String; write::Bool, kw::@Kwargs{})
│        @ RastersArchGDALExt ~/.julia/packages/Rasters/3wmT2/ext/RastersArchGDALExt/gdal_source.jl:114
│     [17] _open
│        @ ~/.julia/packages/Rasters/3wmT2/ext/RastersArchGDALExt/gdal_source.jl:90 [inlined]
│     [18] #_open#14
│        @ ~/.julia/packages/Rasters/3wmT2/src/sources/sources.jl:77 [inlined]
│     [19] Rasters.Raster(filename::String; source::Rasters.NoKW, kw::@Kwargs{name::Symbol, crs::Rasters.NoKW})
│        @ Rasters ~/.julia/packages/Rasters/3wmT2/src/array.jl:292

Package versions:

   Installed GDAL_jll ──────────────────── v301.900.0+0
   Installed ArchGDAL ──────────────────── v0.9.3

and master of Rasters.

Could be that the old ArchGDAL version is the issue? Not sure.

asinghvi17 commented 3 weeks ago

This works with ArchGDAL and Rasters at master: https://geo.makie.org/previews/PR230/examples/rasters

rafaqz commented 3 weeks ago

Master of both or just here?

asinghvi17 commented 3 weeks ago

Ah sorry, it's the la/compacts branch here (Makie compat) and the master branch of ArchGDAL that it works on.