[gdal-dev] Utilities as a library, C API
lucena_ivan at hotmail.com
Wed Oct 19 12:47:24 PDT 2016
I am trying to use C API defined in gdal_utils.h.
By reading the RFC 59.1 I understand that the SWIG wrappers will have a nice interface to pass the parameters , ex.:
format --- output format ("GTiff", etc...)
outputType --- output type (gdal.GDT_Byte, etc...)
bandList --- array of band numbers (index start at 1)
srcWin --- subwindow in pixels to extract: [left_x, top_y, width, height]
But it seems like for C, the only way to pass the parameters will be by passing "char** papszArgv" in the same fashion as GDAL command line.
That doesn't seems to be fair with poor C programmers like me. We would need to translate things like "format=XXX" to "-of XXX" and "outputType=XXX" to "-ot XXX" for all the options and all the utilities.
The GDALTranslateOptions is opaque , so we cannot access it's member either. See commented line and the error message:
GDALTranslateOptions* psOptions = GDALTranslateOptionsNew( papszArgv, NULL );
// psOptions->pszFormat = pszOutDriver; // error: dereferencing pointer to incomplete type
hDstDataset = GDALTranslate(
(const char*) pszOutFilename,
(const GDALTranslateOptions*) psOptions,
(int*) NULL );
GDALTranslateOptionsFree( psOptions );
Is there any other way to pass the parameters to the GDAL "Utilities as Libraries" in C?
 - https://trac.osgeo.org/gdal/wiki/rfc59.1_utilities_as_a_library
 - http://www.gdal.org/gdal__utils_8h.html
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the gdal-dev