[Gdal-dev] Determining Opened File Format?
Frank Warmerdam
warmerdam at pobox.com
Sun Feb 23 04:10:06 EST 2003
Ayman Kamal wrote:
> Your technique didn't work, I tried it with two files
> of type TIF ( not GeoTiff )
>
> and your code didn't return that the file format isn't
> GeoTiff
>
> here is the code snap:
> //////////////////////////////////////////////////////
> GDALDriverH hInputDriver;
> const char *szShortDriverName;
> hInputDriver = GDALGetDatasetDriver( hDataset );
> szShortDriverName = GDALGetDriverShortName(
> hInputDriver );
> if ( 0 != strcmp(szShortDriverName,"GTiff") )
> {
> printf("\nThis is not a GeoTiff file format\n");
> return 1;
> }
> //////////////////////////////////////////////////////
Ayman,
TIFF and GeoTIFF both go through the GTiff driver. There is no certain
way of establishing that a TIFF file is not also a GeoTIFF file through
GDAL, but if the driver is "GTiff", and projection string is "" and the
geotransform is [0,1,0,0,0,1] then it is likely not a geotiff file.
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
More information about the Gdal-dev
mailing list