Opened 12 years ago

Closed 12 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:
Cc:

Description

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>http://wms.agiv.be/inspire/wms/orthobeeldvorming</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 
   MsgBox(Complete.ToString) 
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 by nowakpl, 12 years ago

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 by MaksimS, 12 years ago

Resolution: fixed
Status: newclosed

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

comment:3 by nowakpl, 12 years ago

Resolution: fixed
Status: closedreopened

comment:4 by nowakpl, 12 years ago

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