Opened 15 years ago

Closed 15 years ago

#3052 closed defect (fixed)

poBand->SetMetadataItem( "source_0", szFilterSourceXML, "vrt_sources" ) not supported as expected

Reported by: Even Rouault Owned by: Even Rouault
Priority: normal Milestone: 1.6.2
Component: GDAL_Raster Version: unspecified
Severity: normal Keywords:
Cc: belaid_moa@…

Description

The VRT tutorial says that poBand->SetMetadataItem( "source_0", szFilterSourceXML, "vrt_sources" ) in the following snippet should be supported, but the code has never been implemented for SetMetadataItem() (although it has been for SetMetadata.)

  int   nBand;
  GDALDriver *poDriver = (GDALDriver *) GDALGetDriverByName( "VRT" );
  GDALDataset *poSrcDS, *poVRTDS;

  poSrcDS = (GDALDataset *) GDALOpenShared( pszSourceFilename, GA_ReadOnly );

  poVRTDS = poDriver->CreateCopy( "", poSrcDS, FALSE, NULL, NULL, NULL );

  for( nBand = 1; nBand <= poVRTDS->GetRasterCount(); nBand++ )
  {
      char szFilterSourceXML[10000];

      GDALRasterBand *poBand = poVRTDS->GetRasterBand( nBand );

      sprintf( szFilterSourceXML, 
	"<KernelFilteredSource>"
	"  <SourceFilename>%s</SourceFilename>1<SourceBand>%d</SourceBand>"
	"  <Kernel>"
	"    <Size>3</Size>"
	"    <Coefs>0.111 0.111 0.111 0.111 0.111 0.111 0.111 0.111 0.111</Coefs>"
	"  </Kernel>"
	"</KernelFilteredSource>", 
	pszSourceFilename, nBand );
	
      poBand->SetMetadataItem( "source_0", szFilterSourceXML, "vrt_sources" );
  }

Change History (1)

comment:1 by Even Rouault, 15 years ago

Milestone: 1.6.2
Resolution: fixed
Status: newclosed

Fixed in trunk (r17332) and branches/1.6 (r17333). Tests added in r17334

Note: See TracTickets for help on using tickets.