29 static ossimTrace traceExec (
"ossimQuickbirdMetaData:exec");
30 static ossimTrace traceDebug (
"ossimQuickbirdMetaData:debug");
34 theGenerationDate(
"Unknown"),
38 theTLCDate(
"Unknown"),
45 theBandNameList(
"Unknown"),
58 static const char MODULE[] =
"ossimQuickbirdMetaData::open";
74 << MODULE <<
" errors parsing metadata" << std::endl;
102 out <<
"\n----------------- Info on Quickbird Image -------------------" 115 <<
"\n abs Calibration Factors: " 123 <<
"\n---------------------------------------------------------" 124 <<
"\n " << std::endl;
129 const char* prefix)
const 133 "ossimQuickbirdMetaData",
177 "sat_elevation_angle",
193 for(
unsigned int i = 0 ; i < bandNameList.size(); ++i)
196 bandNameList[i] +
"_band_absCalFactor",
218 const char* lookup = 0;
225 if(s !=
"ossimQuickbirdMetaData")
231 lookup = kwl.
find(prefix,
"generation_date");
237 lookup = kwl.
find(prefix,
"band_id");
243 lookup = kwl.
find(prefix,
"bits_per_pixel");
250 lookup = kwl.
find(prefix,
"sat_id");
256 lookup = kwl.
find(prefix,
"tlc_date");
262 lookup = kwl.
find(prefix,
"TDI_level");
283 lookup = kwl.
find(prefix,
"sat_azimuth_angle");
290 lookup = kwl.
find(prefix,
"sat_elevation_angle");
297 lookup = kwl.
find(prefix,
"band_name_list");
307 for(
unsigned int i = 0 ; i < bandNameList.size() ; ++i)
309 lookup = kwl.
find(prefix, bandNameList[i] +
"_band_absCalFactor");
320 lookup = kwl.
find(prefix,
"absCalFactor");
342 if (traceExec())
ossimNotify(
ossimNotifyLevel_WARN) <<
"ossimQuickbirdMetaData::parseMetaData(data_file) WARN:" <<
"\nmetadate data file <" << data_file <<
">. " <<
"doesn't exist..." << std::endl;
347 FILE* fptr = fopen (data_file,
"r");
353 <<
"ossimQuickbirdRpcModel::parseMetaData(data_file) DEBUG:" 354 <<
"\nCould not open Meta data file: " << data_file
355 <<
"\nreturning with error..." << std::endl;
366 char*
filebuf =
new char[fileSize];
367 fread(
filebuf, 1, fileSize, fptr);
383 <<
"FATAL ossimQuickbirdRpcModel::parseMetaData(data_file): " 384 <<
"\n\tAborting construction. Error encountered parsing " 385 <<
"presumed meta-data file." << std::endl;
409 <<
"FATAL ossimQuickbirdRpcModel::parseMetaData(data_file): " 410 <<
"\n\tAborting construction. Error encountered parsing " 411 <<
"presumed meta-data file." << std::endl;
429 <<
"FATAL ossimQuickbirdRpcModel::parseMetaData(data_file): " 430 <<
"\n\tAborting construction. Error encountered parsing " 431 <<
"presumed meta-data file." << std::endl;
443 unsigned int nbBand = 0;
445 for(iter = strstr(iter,
"BEGIN_GROUP = BAND_"); iter ; iter = strstr(iter,
"BEGIN_GROUP = BAND_"))
448 char dummy[80], nameChar[80];
449 sscanf(iter,
"%19c %s", dummy, nameChar);
459 std::vector<ossimString> bandList;
462 for(
unsigned int j=0; j<bandList.size(); j++)
464 ossimString begin_group =
"BEGIN_GROUP = BAND_" + bandList[j];
466 if(!strptr && traceDebug())
469 <<
"FATAL ossimQuickbirdRpcModel::parseMetaData(data_file): " 470 <<
"\n\tAborting construction. Error encountered parsing " 471 <<
"presumed meta-data file." << std::endl;
477 char dummy[80], nameChar[80];
478 sscanf(strptr,
"%19c %s", dummy, nameChar);
480 if(!strptr && traceDebug())
483 <<
"FATAL ossimQuickbirdRpcModel::parseMetaData(data_file): " 484 <<
"\n\tAborting construction. Error encountered parsing " 485 <<
"presumed meta-data file." << std::endl;
491 if(bandList[j] == bandCur)
493 strptr = strstr(strptr,
"\tabsCalFactor = ");
494 sscanf(strptr,
"%16c %s", dummy, nameChar);
512 <<
"FATAL ossimQuickbirdRpcModel::parseMetaData(data_file): " 513 <<
"\n\tAborting construction. Error encountered parsing " 514 <<
"presumed meta-data file." << std::endl;
532 <<
"FATAL ossimQuickbirdRpcModel::parseMetaData(data_file): " 533 <<
"\n\tAborting construction. Error encountered parsing " 534 <<
"presumed meta-data file." << std::endl;
555 <<
"FATAL ossimQuickbirdRpcModel::parseMetaData(data_file): " 556 <<
"\n\tAborting construction. Error encountered parsing " 557 <<
"presumed meta-data file." << std::endl;
578 <<
"FATAL ossimQuickbirdRpcModel::parseMetaData(data_file): " 579 <<
"\n\tAborting construction. Error encountered parsing " 580 <<
"presumed meta-data file." << std::endl;
602 <<
"FATAL ossimQuickbirdRpcModel::parseMetaData(data_file): " 603 <<
"\n\tAborting construction. Error encountered parsing " 604 <<
"presumed meta-data file." << std::endl;
626 <<
"FATAL ossimQuickbirdRpcModel::parseMetaData(data_file): " 627 <<
"\n\tAborting construction. Error encountered parsing " 628 <<
"presumed meta-data file." << std::endl;
650 <<
"FATAL ossimQuickbirdRpcModel::parseMetaData(data_file): " 651 <<
"\n\tAborting construction. Error encountered parsing " 652 <<
"presumed meta-data file." << std::endl;
675 <<
"FATAL ossimQuickbirdRpcModel::parseMetaData(data_file): " 676 <<
"\n\tAborting construction. Error encountered parsing " 677 <<
"presumed meta-data file." << std::endl;
699 <<
"FATAL ossimQuickbirdRpcModel::parseMetaData(data_file): " 700 <<
"\n\tAborting construction. Error encountered parsing " 701 <<
"presumed meta-data file." << std::endl;
720 <<
"FATAL ossimQuickbirdRpcModel::parseMetaData(data_file): " 721 <<
"\n\tAborting construction. Error encountered parsing " 722 <<
"presumed meta-data file." << std::endl;
736 <<
"DEBUG ossimQuickbirdRpcModel::parseMetaData(data_file): returning..." 784 static const char MODULE[] =
"ossimQuickbirdMetaData::getMapProjectionKwl";
794 FILE* fptr = fopen (imd_file.
c_str(),
"r");
804 char*
filebuf =
new char[fileSize];
805 fread(
filebuf, 1, fileSize, fptr);
818 imd_key =
"BEGIN_GROUP = MAP_PROJECTED_PRODUCT";
838 <<
"Unhandled datum: " << tempStr <<
"\n";
849 value =
"ossimUtmProjection";
857 <<
"Unhandled projection name: " << tempStr <<
"\n";
868 value =
"ossimUtmProjection";
887 tempStr = tempStr.
trim(
";");
888 tempStr = tempStr.
trim(
"\"");
904 if ( tempStr ==
"\"M\";" )
915 <<
"Unhandled units: " << tempStr <<
"\n";
925 tempStr = tempStr.
trim(
";");
934 tempStr = tempStr.
trim(
";");
943 key =
"tie_point_units";
946 key =
"tie_point_xy";
955 <<
"tie point has nans!";
964 tempStr = tempStr.
trim(
";");
973 tempStr = tempStr.
trim(
";");
983 key =
"pixel_scale_units";
986 key =
"pixel_scale_xy";
995 <<
"scale has nans!";
1008 if ( result ==
false )
1013 <<
"ERROR: Missing or unhandled key in metadat: " << imd_key <<
"\n";
1025 <<
"ossimQuickbirdRpcModel::parseMetaData(imd_file) DEBUG:" 1026 <<
"\nCould not open Meta data file: " << imd_file
1027 <<
"\nreturning with error...\n";
1035 << MODULE <<
" exit status = " << (result?
"true":
"false") <<
"\n";
1049 const char * format,
1064 char * res = strstr(fileBuf, lineBeginning.
c_str());
1069 fileBuf = strstr(fileBuf, lineBeginning.
c_str());
1070 char dummy[80], nameChar[80];
1071 sscanf(fileBuf, format, dummy, nameChar);
ossimString before(const ossimString &str, std::string::size_type pos=0) const
METHOD: before(str, pos) Returns string beginning at pos and ending one before the token str If strin...
std::basic_filebuf< char > filebuf
Class for char file buffers.
Represents serializable keyword/value map.
const char * find(const char *key) const
ossim_int64 fileSize() const
bool contains(char aChar) const
void split(std::vector< ossimString > &result, const ossimString &separatorList, bool skipBlankFields=false) const
Splits this string into a vector of strings (fields) using the delimiter list specified.
void addPair(const std::string &key, const std::string &value, bool overwrite=true)
static const char * TYPE_KW
void add(const char *prefix, const ossimKeywordlist &kwl, bool overwrite=true)
ossimString trim(const ossimString &valueToTrim=ossimString(" \\)) const
this will strip lead and trailing character passed in.
ossim_float64 toFloat64() const
static const char * AZIMUTH_ANGLE_KW
ossimString toString(ossim_uint32 precision=15) const
const char * c_str() const
Returns a pointer to a null-terminated array of characters representing the string's contents...
static const char * ELEVATION_ANGLE_KW
ossimFilename & setExtension(const ossimString &e)
Sets the extension of a file name.
ossimString after(const ossimString &str, std::string::size_type pos=0) const
METHOD: after(str, pos) Returns string immediately after the token str.
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
std::basic_ostream< char > ostream
Base class for char output streams.
const std::string & string() const