[Gdal-dev] how to know if GDALOpen(filename,GA_Update) is val

Stephane Routelous route at cae.com
Mon Oct 4 17:19:26 EDT 2004


I entered it in bugzilla ( Bug 627 ).

thanks again.

Stephane

-----Original Message-----
From: Frank Warmerdam [mailto:warmerdam at pobox.com]
Sent: Monday, October 04, 2004 4:28 PM
To: Stephane Routelous
Cc: 'gdal-dev at xserve.flids.com'
Subject: Re: [Gdal-dev] how to know if GDALOpen(filename,GA_Update) is
valid ?


Stephane Routelous wrote:
> Hi,
> 
> according to the documentation of GDALOpen, "Many drivers support only
read
> only access".
> How do I know if a driver only has read access ?
> 
> Because, if I really need to open a raster in read/write mode, if the
driver
> does not support write, I need to use a in-memory raster if the driver
> supports createcopy.
> 
> ex : (pseudo-code)
> 
> GDALDataset* ds = GDALOpen(filename,GA_Update); //let's say the driver for
> "filename" has only read access
> GDALRasterBand* band = ds->GetRasterBand(1);
> band->RasterIO( GF_Write,whatever the other parameters are);//here,
problem.

Stephane,

Currently there is no way to know if a driver supports read-only or
read-write
for existing files other than to open the file in update mode, and if that
succeeds to try and write some data.  I am afraid that many drivers that
don't really support update mode will still allow an update mode open to
succeed, though that is clearly a bug.

Sorry,

-- 
---------------------------------------+------------------------------------
--
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    | Geospatial Programmer for Rent



More information about the Gdal-dev mailing list