[Gdal-dev] Any way in GDAL to read only metadata from GeoTIFF
file?
Frank Warmerdam
warmerdam at pobox.com
Thu May 20 21:09:08 EDT 2004
Wedding John B Dr DLVA wrote:
> Greetings,
>
> I have an application for which I want to use the parsing capabilities of
> GDAL for GeoTIFF, DTED, and NITF. However, the application already has a
> nice image handling library (ImageMagick) and I'd prefer to use that for
> displaying the image and manipulating it. It handles TIFF, but ignores any
> tags for extended TIFFs like GeoTIFF when loading the file.
>
> What I'd like to do is to read the metadata information _only_ using GDAL,
> store it, and read in the image data with the ImageMagick (IM) functions so
> that I have all of the IM capability, but also have knowledge of the GeoTIFF
> metadata.
>
> I suppose that I could just use GDALOpen() but it seems dumb to load in the
> whole image only to discard most of it. The main reason why I don't use
> libgeotiff directly is because I also want NITF and DTED parsing.
>
> So my question is: Is there any easy way in GDAL to read only metadata (not
> the image data) from a GeoTIFF file (or any other supported format, for that
> matter)? Put another way, I'd like to fill everything in C++ GDALDataset
> object, minus all of the raster bands and any values derived directly from
> the raster band data.
John,
The good news is that GDALOpen() does not normally read any of the imagery
data, and this is certainly true of the NITF, GeoTIFF and DTED drivers. So
just go ahead and open it with GDALOpen(), and use GDALGetGeoTransform()
and GDALGetProjectionRef() (and any other metadata type functions) freely
without calling any of the imagery functions and you should be fine.
There are a few drivers (ie. USGS DEM) that read the whole image into memory
as part of reading the metadata in the open, but they are the exception.
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