Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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

OSGeo.GDAL.Gdal.RasterizeLayer(
    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).

Question:
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?

share|improve this question
add comment

1 Answer 1

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.?

share|improve this answer
    
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 –  rashad 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 –  rashad Nov 11 '12 at 10:20
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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