Opened 10 years ago

Closed 10 years ago

#4449 closed defect (invalid)

C# bindings - CreateCopy() progress delegate fails for WMS

Reported by: MaksimS Owned by: tamas
Priority: normal Milestone: 1.9.1
Component: CSharpBindings Version: 1.8.1
Severity: normal Keywords:


It seems that there's issues while setting a progress delegate on CreateCopy() for PNG imagery being fetched using WMS driver. Here's the example:

Dim ds_in As Dataset = Gdal.Open("<GDAL_WMS><Service name="WMS"><Version>1.3.0</Version><ServerUrl></ServerUrl><CRS>CRS:84</CRS><ImageFormat>image/png</ImageFormat><Transparent>True</Transparent><Layers>RGB</Layers><Styles></Styles></Service><DataWindow><UpperLeftX>3.76302095985856</UpperLeftX><UpperLeftY>50.9987228424621</UpperLeftY><LowerRightX>3.76629196690679</LowerRightX><LowerRightY>50.9968195506639</LowerRightY><SizeX>2439</SizeX><SizeY>2255</SizeY></DataWindow><Projection>EPSG:4326</Projection></GDAL_WMS>", Access.GA_ReadOnly) 

Dim drv As Driver = Gdal.GetDriverByName("PNG") 

Dim ds_out As Dataset = drv.CreateCopy("C:\Test.png", ds_in, 0, Nothing, New Gdal.GDALProgressFuncDelegate(AddressOf ProgressFunc), "") 

There's also callback function reporting progress:

Private Function ProgressFunc(Complete As Double, Message As System.IntPtr, Data As System.IntPtr) As Integer 
End Function 

Above example fails with "libpng: No IDATs written into file" exception.

But, if there's no callback function set:

ds_out = drv.CreateCopy("C:\Test.png", ds_in, 0, Nothing, Nothing, Nothing) 

...everything works fine.

Change History (4)

comment:1 Changed 10 years ago by nowakpl

I don't know C# but progress function should 1 to continue, yours doesn't seem to return anything so probably ends with a 0.

comment:2 Changed 10 years ago by MaksimS

Resolution: fixed
Status: newclosed

You're right, I need to underline this in C# wiki.

comment:3 Changed 10 years ago by nowakpl

Resolution: fixed
Status: closedreopened

comment:4 Changed 10 years ago by nowakpl

Resolution: invalid
Status: reopenedclosed
Note: See TracTickets for help on using tickets.