[Gdal-dev] Determining Opened File Format?

Frank Warmerdam warmerdam at pobox.com
Sun Feb 23 03:25:43 EST 2003


Ayman Kamal wrote:
> I am using GDAL to open GeoTiff files, I want a
> function to tell me if the file being opened is
> GeoTiff or not, so that I refuse to open it if it is
> not GeoTiff.
> 
> How can I do this?

Ayman,

Call GDALGetDatasetDriver() to get back a GDALDriverH for the dataset, and
they get the short name using GDALGetDriverShortName().  Check if this is
"GTiff".

Good idea to avoid all those other dirty formats. Make them stick with GeoTIFF.

Later,
-- 
---------------------------------------+--------------------------------------
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