Ticket #3052 (closed defect: fixed)

Opened 3 years ago

Last modified 3 years ago

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

Reported by: rouault Owned by: 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

Changed 3 years ago by rouault

  • status changed from new to closed
  • resolution set to fixed
  • milestone set to 1.6.2

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

Note: See TracTickets for help on using tickets.