[Gdal-dev] Re: How to get configuration options

Frank Warmerdam warmerdam at pobox.com
Mon Aug 21 13:04:25 EDT 2006


Daniele Romagnoli wrote:
> Hi list,
> I have another stupid question for you :)
> 
> I'm using Java and I'm trying to detect if GDAL is using CACHE.
> Which is the right way to use gdal.GetConfigOption(String, String)?
> 
> I'have tried:
> String useCache = gdal.GetConfigOption("GDAL_FORCE_CACHING", null);
> It returns null;
> 
> I'have tried:
> String useCache = gdal.GetConfigOption("GDAL_FORCE_CACHING", "");
> It returns null;
> 
> I'have tried:
> String useCache = gdal.GetConfigOption("GDAL_FORCE_CACHING", "Hello!");
> It returns "Hello!".
> 
> 
> Where am I wrong?

Daniele,

Config options are something that can be set by the user or application
and normally there are none set in which case GDAL uses it's internal
defaults for config based decisions.  So the fact that you get "Hello!"
back just means that this config options is not set.

Currently the default behavior is to treat GDAL_FORCE_CACHING as NO if
it is not set, so you should likely use that as your default.

Be forewarned that a variety of values are legal (true, false, yes, no,
1, 0, on, off).

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 OSGF, http://osgeo.org




More information about the Gdal-dev mailing list