[Gdal-dev] input format

Frank Warmerdam warmerdam at pobox.com
Mon Nov 20 23:41:48 EST 2006


Matt Hanson wrote:
> In thinking about this more, it would be really easy to specify a format if
> there was a way to register drivers using text string.   Is there a way to
> do this?   So, instead of having to call Register_VRT you call 
> RegisterDriver("VRT") Easy enough for me to write my own function to do this
> with all the drivers, but it may be useful enough for other users.
> 
> This way you can write an exe that takes in format as a string, and you only
> Register that format and read in that file.  Follow it up with a
> RegisterAll() if the program makes use of other formats.    A similar
> UnregisterDriver(string format) would be userful as well.

Matt,

You cannot register drivers by name.  Till they are actually registered
there is no master list of drivers.

You can unregister them by name doing something like:

   GDALDeregisterDriver( GDALGetDriverByName( "VRT" ) );

You can call GDALRegisterAll(), then fetch the list of all drivers and
unregister them, keeping them in some sort of associative array indexed
by name if you want.  Note you can use GDALGetDriverShortName() to fetch
the name of a driver pulled back from GDALGetDriver().

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | President OSGeo, http://osgeo.org




More information about the Gdal-dev mailing list