[Gdal-dev] Create method

Julien Demaria dem at acri-st.fr
Fri Sep 24 10:27:24 EDT 2004


I think this is incompatible with the GDAL API, but would it be possible 
(theoritically) to provide a "limited write only" approach in which we give 
all the file format informations (colortable, geolocation, nodata, ...) 
only one time at the create call (a CreateSimple method ?), and allow only 
to write in sequential line-by-line way ?
This approach could be implemented easily for many more drivers than the 
standard Create approach, isn't it ?



At 16:01 24/09/2004, Frank Warmerdam wrote:
>Pereira, Ricardo Scachetti wrote:
>>         Hi, folks,
>>         GDAL supports creation of many raster formats from table on this 
>> url: _http://www.remotesensing.org/gdal/formats_list.html_
>>         But then when I check if the drivers support the Create method, 
>> with a call like this:
>>   poDriver = GetGDALDriverManager()->GetDriverByName("AAIGrid");
>>   if( poDriver == NULL ) exit( 1 );
>>   papszMetadata = poDriver->GetMetadata();
>>   bool result = ( CSLFetchBoolean( papszMetadata, GDAL_DCAP_CREATE, 
>> FALSE ) );
>>         Only BMP and Gtiff seem to support it.
>>         So my question is, what is the alternative method of creating 
>> raster datasets using the various drivers, other than using Create()? 
>> Why some drivers implement it and others don't?
>There are basically two ways of creating files with GDAL.  One pre-creates
>the file, and then you use the various GDAL "set" functions and the
>RasterIO() calls to write out metadata and image data.  This is the Create()
>The other approach is to use the CreateCopy() in which case you have to
>provide an input file that has the configuration you want in the output
>file and it will copy everything to the new file before returning control.
>Many formats only support CreateCopy() because it is often difficult to
>implement "random update".  For instance, when writing a PNG file you need
>to do things in a particular order.  The colormap may need to be written
>first, and once the image data is written (always top to bottom) it cannot
>be updated again.
>So for formats where I am constrained by the underlying library, or challenges
>in the format itself I will generally only implement CreateCopy().
>However, there should be several formats that do support direct Create(),
>including (I think) VRT, NITF, HFA, MEM, PCIDSK and possibly a few others.
>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    | Geospatial Programmer for Rent
>Gdal-dev mailing list
>Gdal-dev at xserve.flids.com

More information about the Gdal-dev mailing list