[Gdal-dev] Dataset instance has no attribute 'GetMetadataItem'

Mateusz Loskot mateusz at loskot.net
Tue Jan 16 12:19:33 EST 2007


Martel, Christian wrote:
> Hi,
> 
> With fwtools 1.1.3 on XP, I wrote this python script :
> 
> import gdal
> gdal.AllRegister()
> dataset =
> gdal.Open('d:/geodata/digest/cib/cb05NJ1701_2/rpf/GJKJI22/00A56324.I22')
> fdt = dataset.GetMetadataItem("NITF_FDT")
> print fdt
> 
> I get 
> AttributeError: Dataset instance has no attribute 'GetMetadataItem'
> 
> I get the same answer with a tiff file.
> Plain GetMetadata() works great but I'd like to get specific item.
> 
> I found no sample python script using GetMetadataItem. How should I call
> it ?

Martel,

Under Python, there is no need for GetMetadataItem(), becasue
GetMetadata returns dictionary, so here is how you can access its elements:

fdt = dataset.GetMEtadata()
print fdt['NITF_FDT']


Cheers
-- 
Mateusz Loskot
http://mateusz.loskot.net



More information about the Gdal-dev mailing list