[Gdal-dev] how to write out a tiff file using GDAL?

cudars cudars at yeah.net
Sat Dec 5 01:16:31 EST 2009




Frank Warmerdam wrote:
> 
> cudars wrote:
>> I have read GDAL API Tutorial.
>> The Tutorial wrote "Once the dataset is successfully created, all
>> appropriate metadata and raster data must be written to the file. What
>> this
>> is will vary according to usage, but a simple case with a projection,
>> geotransform and raster data is covered here."
>> 
>> If I want to write more metadata other than projection, geotransform etc,
>> What should I do?
>> I want to keep the original tiff file metadata and add my metadata to the
>> new create tiff.
> 
> Cudars,
> 
> In C++ you could do:
> 
>    poDstDS->SetMetadata( poSrcDS->GetMetadata() );
> 
> to copy the primary metadata domain from GDALDataset poSrcDS to
> GDALDataset
> poDstDS.  You could also loop over the bands, and do something similar
> with
> them.  You can then set individual metadata items with the
> SetMetadataItem()
> method.
> 
>    poDstDS->SetMetadataItem( "TIFFTAG_DOCUMENTNAME", "My first english
> essay" );
> 
> Generic metadata is access via the metadata methods on the GDALMajorObject
> from which both GDALDataset and GDALRasterBand are derived.
> 
>    http://www.gdal.org/classGDALMajorObject.html
> 
> 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 lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
> 
> 

Thanks. Frank. You are always so kind.

-- 
View this message in context: http://n2.nabble.com/how-to-write-out-a-tiff-file-using-GDAL-tp4112637p4116617.html
Sent from the GDAL - Dev mailing list archive at Nabble.com.


More information about the gdal-dev mailing list