| 33 | |
| 34 | '''2. Integration of cpp GDAL utilities into GDAL core library'''[[BR]] |
| 35 | |
| 36 | There has been expressed interest several times to have e.g. the VRTBuilder class included in GDAL core. This proposal extends the idea by integrating all functionality of cpp GDAL utilities into GDAL core, providing an unique entry point like |
| 37 | |
| 38 | {{{ |
| 39 | int GDALRunUtility(const char* pszArguments, GDALProgressFunc pfnProgress, void* pProgressArg, ...) |
| 40 | }}} |
| 41 | |
| 42 | allowing something like the following syntax: |
| 43 | |
| 44 | {{{ |
| 45 | GDALRunUtility("gdal_translate in.tif out.tif -of PNG", NULL, NULL) |
| 46 | or |
| 47 | GDALRunUtility("gdalwarp $1 out.tif -t_srs EPSG:4326", NULL, NULL, hSrcDS) |
| 48 | or |
| 49 | GDALRunUtility("gdalwarp $1 &$2 -t_srs EPSG:4326 -of MEM", NULL, NULL, hSrcDS, &hOutDS) |
| 50 | or |
| 51 | GDALRunUtility("gdalbuildvrt out.vrt *.tif", NULL, NULL) |
| 52 | or |
| 53 | GDALRunUtility("gdalbuildvrt out.vrt $*", NULL, NULL, hSrcDS1, hSrcDS2, NULL) |
| 54 | or |
| 55 | GDALRunUtility("gdalbuildvrt &$1 $*", NULL, NULL, &hOutVRT, hSrcDS1, hSrcDS2, NULL) |
| 56 | |
| 57 | where : |
| 58 | $X is substituted with a GDAL object (input) |
| 59 | &$X is substituted with a GDAL object (output) |
| 60 | $* is substituted with a NULL-terminated list of GDAL objects |
| 61 | }}} |
| 62 | |
| 63 | The utilities then would be just a simple main that would call the library code. |
| 64 | |
| 65 | Besides other advantages, the incorporation would allow more flexible application development, e.g. calling GDAL utilities without the need to make system calls. |
| 66 | |
| 67 | |
| 68 | The project consists of: |
| 69 | * extracting the code of the utilities, i.e. removing any exit(), global variables, etc., and convert them to proper functions |
| 70 | * integrating the code in libgdal (or a libgdal_utilities) |
| 71 | * developing a proper syntax for GDALRunUtility() |
| 72 | * exchanging utilitiy code with a simple main calling GDALRunUtility() |
| 73 | * checking compatibility with SWIG bindings |
| 74 | * updating the build system and bindings |
| 75 | |
| 76 | |