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

Martel, Christian Christian.Martel at drdc-rddc.gc.ca
Tue Jan 16 15:52:47 EST 2007


------This message was previously sent only to Frank (reply instead of
reply to all). My apologizes to all list members.------

Mateusz,
Frank,

Thanks for the quick answer.
I was aware of that solution. I though GetMetadataItem would be faster
because I want to extract the same metadata from hundreds of files (a
whole CIB CD). 

Thanks,
Christian

> -----Original Message-----
> From: Frank Warmerdam [mailto:warmerdam at pobox.com] 
> Sent: 16 janvier 2007 12:28
> To: Martel, Christian
> Cc: gdal-dev at lists.maptools.org
> Subject: Re: [Gdal-dev] Dataset instance has no attribute 
> 'GetMetadataItem'
> 
> 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 ?
> 
> Christian,
> 
> I see that neither the old nor the new python bindings have a 
> getmetadataitem operation.  You basically have to fetch all 
> the metadata, and then check for the individual item.
> 
> eg.
> 
>    md = dataset.GetMetadata()
>    if md.has_key('NITF_FDT'):
>      print md['NITF_FDT']
> 
> 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    | President OSGeo, 
> http://osgeo.org
> 
> 




More information about the Gdal-dev mailing list