wiki:rfc59_utilities_as_a_library

Version 7 (modified by faza, 9 years ago) ( diff )

--

RFC 59 : GDAL/OGR utilities as a library

Authors: Faza Mahamood

Contact: fazamhd at gmail dot com

Status: Development

Implementation version: 2.1

Summary

This RFC defines new function for each GDAL utility. The utility code is modified to call the new function. This RFC gives a general frame and principles, demonstrated with gdalinfo, but aimed at being extended with other utilities.

Rationale

There is need for calling utilities from the code. But this involves using system calls and cannot work on in-memory datasets.

Changes

New library libgdalutils is created. The GDAL utilities are modified to use the new functions. New header file gdal_utils.h is created which contains the public declarations of GDAL utilities. The current header(still in progress) can be found here.

    char CPL_DLL *GDALInfo( GDALDatasetH hDataset, GDALInfoOptions *psOptions );

    GDALInfoOptions CPL_DLL *GDALInfoOptionsNew( void );

    void CPL_DLL GDALInfoOptionsAddExtraMDDomains( GDALInfoOptions *psOptions,
                                                   const char *pszDomain );

    void CPL_DLL GDALInfoOptionsSetExtraMDDomains( GDALInfoOptions *psOptions,
                                                   char **papszExtraMDDomains );

    void CPL_DLL GDALInfoOptionsFree( GDALInfoOptions *psOptions );

SWIG bindings (Python / Java / C# / Perl) changes

For Python bindings only, new function Info() is added in the gdal module which uses the new GDALInfo() function.

    gdal.Info(ds, options, deserialize = True)

    gdal.Info(ds, options = None, format = _gdal.INFO_FORMAT_TEXT, deserialize = True,
              computeMinMax = False, reportHistograms = False, reportProj4 = False,
              stats = False, approxStats = True, sample = False, computeChecksum = False,
              showGCPs = True, showMetadata = True, showRAT = True, showColorTable = True,
              listMDD = False, showFileList = True, allMetadata = False,
              extraMDDomains = None)
    
    gdal.InfoOptions()

Utilities

Utilities are modified to call the respective function.

Documentation

All new methods/functions are documented.

Test Suite

GDALInfo method is tested in test_gdalinfo_lib.py

Compatibility Issues

Related ticket

Implementation

Implementation will be done by Faza Mahamood.

The proposed implementation lies in the "gdalinfo" branch of the https://github.com/fazam/gdal/tree/gdalinfo.

The list of changes : https://github.com/fazam/gdal/compare/gdalinfo

Voting history

Note: See TracWiki for help on using the wiki.