Skip to content
Snippets Groups Projects
Commit f2f64079 authored by Patrick Imbo's avatar Patrick Imbo
Browse files

MRG

parents 2c9de2a5 d355e7df
Branches
Tags
No related merge requests found
......@@ -19,6 +19,7 @@
#include <iostream>
#include <fstream>
#include <string>
#include "base/ossimFilename.h"
#include "otbGDALImageIO.h"
......@@ -50,15 +51,30 @@ int otbMultiDatasetReadingInfo(int argc, char* argv[])
if (readingSubDatasetInfo == false )
return EXIT_FAILURE;
// Parse all the names to delete the path of the filename
for( unsigned int itSubDataset = 0; itSubDataset < (unsigned int)names.size(); itSubDataset++ )
{
std::size_t posDeb = names[itSubDataset].find(":\"");
if (posDeb==std::string::npos)
return EXIT_FAILURE;
std::size_t posEnd = names[itSubDataset].rfind("\":");
if (posEnd==std::string::npos)
return EXIT_FAILURE;
// Remove the path from the SubDataset_name metadata
std::string strFilepath = names[itSubDataset].substr(posDeb+2, posEnd - posDeb - 2);
ossimFilename lFile = ossimFilename(strFilepath);
names[itSubDataset].replace(posDeb+2, posEnd - posDeb - 2, (lFile.file()).c_str() );
}
std::ofstream file;
file.open(outputAsciiFilename);
for( unsigned int itSubDataset = 0; itSubDataset < names.size(); itSubDataset++ )
for( unsigned int itSubDataset = 0; itSubDataset < (unsigned int)names.size(); itSubDataset++ )
{
file << "NAME_"<< itSubDataset+1 << " :" << names[itSubDataset] <<std::endl;
//std::cout << "NAME_"<< itSubDataset+1 << " :" << names[itSubDataset] <<std::endl;
file << "DESC_" << itSubDataset+1 << " :" << desc[itSubDataset] <<std::endl;
//std::cout << "DESC_"<< itSubDataset+1 << " :" << desc[itSubDataset] <<std::endl;
file << "NAME_" << itSubDataset+1 << " :" << names[itSubDataset] << std::endl;
file << "DESC_" << itSubDataset+1 << " :" << desc[itSubDataset] << std::endl;
}
file.close();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment