C# bindings CreatePansharpenedVRT

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
Report Content as Inappropriate

C# bindings CreatePansharpenedVRT

This post has NOT been accepted by the mailing list yet.
Hi everybody!
I'm using gdal C# bindings and when I want create a pansharpened image I have nothing.
I've read trac.osgeo.org ticket 6437 but I don't now how to add GDALDatasetShadow to a typemap (swig), so I desided to write some code bellow but its doesn't work. I guess that Gdal.CreatePansharpenedVRT function needed xml file with params, but what params....???

Has anybody any ideas about code (what params) or how to add GDALDatasetShadow to a typemap?
Also I'm trying the decision from ticket 6437, but 'SWIGTYPE_p_p_GDALRasterBandShadow' still been after compile!

        public unsafe static void CreatePanSharpen(Dataset panchromDs)
            Dataset d = Gdal.Open("c:\\multispectral.JP2", Access.GA_ReadOnly);
            IntPtr[] ptr = new IntPtr[4];            
            ptr[0] = Band.getCPtr(d.GetRasterBand(1)).Handle;
            ptr[1] = Band.getCPtr(d.GetRasterBand(2)).Handle;
            ptr[2] = Band.getCPtr(d.GetRasterBand(3)).Handle;
            ptr[3] = Band.getCPtr(d.GetRasterBand(4)).Handle;

            var gcHandle = GCHandle.Alloc(ptr, GCHandleType.Pinned);
            SWIGTYPE_p_p_GDALRasterBandShadow bands = new SWIGTYPE_p_p_GDALRasterBandShadow(gcHandle.AddrOfPinnedObject(), false, d);
            var res = Gdal.CreatePansharpenedVRT(string.Empty, panchromDs.GetRasterBand(1), 4, bands);
            if (res == null) throw new Exception("");
            if (gcHandle.IsAllocated)