I am trying to use the OSGeo.GDAL.Gdal.RasterizeLayer(…) from GDAL 1.9.2 and it requires some SWIGTYPE parameters:

    OSGeo.GDAL.Dataset dataset,
    int bands,
    OSGeo.GDAL.SWIGTYPE_p_int band_list,
    OSGeo.OGR.Layer layer,
    OSGeo.GDAL.SWIGTYPE_p_void pfnTransformer,
    OSGeo.GDAL.SWIGTYPE_p_void pTransformArg,
    int burn_values,
    OSGeo.GDAL.SWIGTYPE_p_double burn_values_list,
    string[] options,
    OSGeo.GDAL.Gdal.GDALProgressFuncDelegate callback,
    string callback_data

Reading up on some old mails somewhere (I've lost the link) regarding ReadRaster and WriteRaster in the C# bindings, Tamas Szekeres states that methods requesting SWIGTYPE parameters, cannot be used (yet).

Does this mean that the RasterizeLayer method hasn’t been ported to the C# bindings or are there some clever way to utilise this method?


SWIG Interface file Operations.i and generated files for csharp in gdal-1.9.1/swig/csharp/gdal/Gdal.cs says that they are available in GDAL C# bindings. Could you please tell what error exactly are you getting when performing rasterization.?

  • I have no idea about how to use the SWIGTYPE parameters, what to initialise them with and so on. – Chau Nov 2 '12 at 10:01
  • SWIGTYPE_p_int is an int array in c# and SWIGTYPE_p_double is double array. so for OSGeo.GDAL.SWIGTYPE_p_int band_list you can provide c# array of int[] try this and see what error you are getting – rkm Nov 3 '12 at 6:18
  • Can you give me an example of how to initialize and what to provide one of the SWIGTYPE parameters with? – Chau Nov 7 '12 at 13:22
  • try C# int where it asks for SWIGTYPE_p_int. i dindt tried myself. Maybe there is a better solution. But there is no harm in trying this – rkm Nov 11 '12 at 10:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.