Opened 8 years ago
Closed 5 years ago
#6437 closed defect (wontfix)
Missing typemaps in C# binding for Gdal
Reported by: | ccjklppp | Owned by: | tamas |
---|---|---|---|
Priority: | highest | Milestone: | closed_because_of_github_migration |
Component: | CSharpBindings | Version: | unspecified |
Severity: | major | Keywords: | |
Cc: |
Description (last modified by )
I'm using the c# binding.all methods that should get as argument Dataset[], actually expects type SWIGTYPE_p_p_GDALDatasetShadow instead.
this happens in the following methods:
Gdal.CreatePansharpenedVRT(...)
Gdal.wrapper_GDALBuildVRT_objects(...)
Gdal.wrapper_GDALWarpDestDS(...)
Gdal.wrapper_GDALWarpDestName(...)
moreover, the method Gdal.wrapper_GDALVectorTranslateDestDS(...) expect to get Datasets (src & dst) while it should get Datasource (vector) isn't it?
Attachments (1)
Change History (15)
comment:2 by , 8 years ago
Description: | modified (diff) |
---|
comment:3 by , 8 years ago
Summary: | Gdal utilities as a library → Missing typemaps in C# binding for Gdal.wrapper_GDALWarpDestName |
---|
comment:5 by , 8 years ago
Milestone: | 2.1.0 → 2.1.1 |
---|
comment:6 by , 8 years ago
I have made a workaround to the problem:
I've changed the gdalwarp interfaces so it will be like the gdalbuildvrt interfaces -
one method gets the input/output file names and another method gets the input/output dataset objects
All the changes I've made are in the file: swig\include\gdal.i
and this is the changed part:
//************************************************************************ // gdal.Warp() //************************************************************************ #ifdef SWIGJAVA %rename (WarpOptions) GDALWarpAppOptions; #endif struct GDALWarpAppOptions { %extend { GDALWarpAppOptions(char** options) { return GDALWarpAppOptionsNew(options, NULL); } ~GDALWarpAppOptions() { GDALWarpAppOptionsFree( self ); } } }; #ifdef SWIGJAVA %rename (Warp) wrapper_GDALWarp_objects; #endif /* Note: we must use 2 distinct names due to different ownership of the result */ %inline %{ int wrapper_GDALWarp_objects( GDALDatasetShadow* dstDS, int object_list_count, GDALDatasetShadow** poObjects, GDALWarpAppOptions* options, GDALProgressFunc callback=NULL, void* callback_data=NULL) { int usageError; /* ignored */ bool bFreeOptions = false; if( callback ) { if( options == NULL ) { bFreeOptions = true; options = GDALWarpAppOptionsNew(NULL, NULL); } GDALWarpAppOptionsSetProgress(options, callback, callback_data); } int bRet = (GDALWarp(NULL, dstDS, object_list_count, poObjects, options, &usageError) != NULL); if( bFreeOptions ) GDALWarpAppOptionsFree(options); return bRet; } %} #ifdef SWIGJAVA %rename (Warp) wrapper_GDALWarp_names; #endif %newobject wrapper_GDALWarp_names; %apply (char **options) {char** source_filenames}; %inline %{ GDALDatasetShadow* wrapper_GDALWarp_names( const char* dest, char ** source_filenames, GDALWarpAppOptions* options, GDALProgressFunc callback=NULL, void* callback_data=NULL) { int usageError; /* ignored */ bool bFreeOptions = false; if( callback ) { if( options == NULL ) { bFreeOptions = true; options = GDALWarpAppOptionsNew(NULL, NULL); } GDALWarpAppOptionsSetProgress(options, callback, callback_data); } int nInputFiles = CSLCount(source_filenames); GDALDatasetH* poObjects = (GDALDatasetH*) CPLMalloc(nInputFiles * sizeof(GDALDatasetH)); for(int i=0;i<nInputFiles;i++) { poObjects[i] = GDALOpen(source_filenames[i], GA_ReadOnly ); } GDALDatasetH hDSRet = GDALWarp(dest, NULL, nInputFiles, poObjects, options, &usageError); for(int i=0;i<nInputFiles;i++) { GDALClose(poObjects[i]); } CPLFree(poObjects); if( bFreeOptions ) GDALWarpAppOptionsFree(options); return hDSRet; } %}
the full file is attached.
I would appreciate if you put the changes to the trunk version...
comment:7 by , 8 years ago
The proposed gdal.i would break the Python bindings. I guess what is needed is a typemap for (int object_list_count, GDALDatasetShadow poObjects) in swig/include/csharp/typemaps_csharp.i
comment:9 by , 8 years ago
Milestone: | 2.1.1 → 2.1.2 |
---|
comment:10 by , 7 years ago
Description: | modified (diff) |
---|---|
Milestone: | 2.1.2 → 2.2.0 |
Summary: | Missing typemaps in C# binding for Gdal.wrapper_GDALWarpDestName → Missing typemaps in C# binding for Gdal |
comment:13 by , 6 years ago
Is this issue planned for the next release? It would be really helpful. This seems to keep getting postponed even though it has the highest priority. Any info on the current state would be appreciated.
comment:14 by , 5 years ago
Milestone: | → closed_because_of_github_migration |
---|---|
Resolution: | → wontfix |
Status: | new → closed |
This ticket has been automatically closed because Trac is no longer used for GDAL bug tracking, since the project has migrated to GitHub. If you believe this ticket is still valid, you may file it to https://github.com/OSGeo/gdal/issues if it is not already reported there.
Tamas, will you be able to work on that for 2.1.0 ?