ossimErrorCode ossimVpfDatabaseHeader::open(const ossimFilename& databaseHeaderTable)
{
    vpf_table_type tableTypeData;

    if( is_vpf_table( databaseHeaderTable.c_str() ) )
    {
        tableTypeData = vpf_open_table(databaseHeaderTable.c_str(),
                                       (storage_type)DISK,
                                       "rb",
                                       NULL);
        if(isDatabaseHeaderTable(tableTypeData))
        {

        }
        else
        {
            return ossimErrorCodes::OSSIM_ERROR;
        }
    }
    else
    {
        return ossimErrorCodes::OSSIM_ERROR;
    }

    return ossimErrorCodes::OSSIM_OK;
}
Esempio n. 2
0
bool ossimVpfTable::openTable(const ossimFilename& tableName)
{
   closeTable();

   if(is_vpf_table(const_cast<char*>(tableName.c_str())))
   {
      if(theTableInformation)
      {
         delete theTableInformation;
         theTableInformation = NULL;
      }
      theTableInformation = new vpf_table_type;
      memset(theTableInformation, 0, sizeof(vpf_table_type));

      theTableName = tableName;
      *theTableInformation = vpf_open_table(const_cast<char*>(tableName.c_str()),
                                            disk,
                                            "rb",
                                            NULL);
   }
   else
   {
      delete theTableInformation;
      theTableInformation = NULL;

      return false;
   }

   return true;
}
Esempio n. 3
0
bool ossimNitfInfo::open(const ossimFilename& file)
{
   bool result = false;
   
   std::string connectionString = file.c_str();
   std::shared_ptr<ossim::istream> str = ossim::StreamFactoryRegistry::instance()->
      createIstream( file.c_str(), std::ios_base::in|std::ios_base::binary);
   
   if ( str )
   {
      result = open(str, connectionString);
   }
   return result;
}
Esempio n. 4
0
bool ossimErsSarModel::isErsLeader(const ossimFilename& file) const
{
  std::ifstream candidate(file.c_str(), ios::in | ios::binary);
  char ersFileName[16];

  candidate.seekg(48);
  if (candidate.bad() || candidate.eof())
  {
    return false;
  }
  candidate.read(ersFileName, 16);
  if (candidate.bad() || candidate.eof())
  {
    return false;
  }
  candidate.close();

  ossimString ersString(ersFileName);

  if ((ersString.find("ERS") == 0)   &&
      (ersString.find(".SAR.") == 4) &&
      (ersString.find("LEAD") == 12))
  {
    return true;
  }
  else
  {
    return false;
  }

}
Esempio n. 5
0
bool ossimXmlDocument::openFile(const ossimFilename& filename)
{
   
   theFilename = filename;

   if(theFilename == "")
   {
      return false;
   }

   //
   // Open XML File:
   // Note: Opening text document binary to overcome an apparent windows bug.
   //
   ifstream xml_stream (filename.c_str(), ios::binary);
   if (!xml_stream)
   {
      if (traceDebug())
      {
         ossimNotify(ossimNotifyLevel_DEBUG)
            << "DEBUG: ossimXmlDocument::ossimXmlDocument\n"
            << "encountered opening file <" << filename << "> for "
            << "reading. Aborting..." << endl;
      }
      return false;
   }

   return read(xml_stream);
}
std::shared_ptr<ossim::ifstream> ossimStreamFactoryRegistry::createIFStream(
   const ossimFilename& file, std::ios_base::openmode openMode) const
{
   std::shared_ptr<ossim::ifstream>result(0);
   
   for(ossim_uint32 idx = 0; ((idx < theFactoryList.size())&&(!result)); ++idx)
   {
      result = theFactoryList[idx]->createIFStream(file, openMode);
   }

   if(!result)
   {
      if(file.exists())
      {
         // there is a bug in gcc < 5.0 and we can't use constructors in the 
         // C++11 build.  Will refactor to do a new ifstream then use open
         //

         result = std::make_shared<ossim::ifstream>();
         result->open(file.c_str(), openMode);
         if(!result->is_open())
         {
            result.reset();
         }
      }
   }
   
   return result; 
   
}
Esempio n. 7
0
void outputTemplateKeywordlist(const ossimFilename &templateFilename)
{
   ofstream out(templateFilename.c_str());

   out << "file1.filename: <full path and file name>" << endl
       << "file2.filename: <full path and file name>" << endl
       << "// :\n"
       << "// :\n"
       << "// fileN: <full path and file name to the Nth file in the list>" << endl
       << "\n// currently this option has been tested\n"
       << "// with ossimTiffWriter and ossimJpegWriter\n"
       << "// writer.type: ossimTiffWriter"            << endl
       << "// writer.filename: <full path to output file>"  << endl
       << "\n// Currently, the mosaic application supports\n"
       << "// SIMPLE mosaics (ie. no blending algorithms)\n"
       << "// BLEND  for maps or layers that you want to blend together\n"
       << "// FEATHER for applying a spatial feaher along overlapped regions\n"
       << "// mosaic.type: SIMPLE"                     << endl
       << "\n// product type and projection information" << endl
       << "// is optional.  It will use the first images"<<endl
       << "// geometry information instead." << endl
       << "// product.type: "        << endl
       << "// product.meters_per_pixel_y: "       << endl
       << "// product.meters_per_pixel_x: "       << endl
       << "// product.central_meridian:   " << endl
       << "// product.origin_latitude:"    << endl;

   ossimNotify(ossimNotifyLevel_NOTICE)
      << "Wrote file: " << templateFilename << std::endl;
}
Esempio n. 8
0
ossimDtedHandler::ossimDtedHandler(const ossimFilename& dted_file, bool memoryMapFlag)
   :
      ossimElevCellHandler(dted_file),
      m_fileStr(),
      m_numLonLines(0),
      m_numLatPoints(0),
      m_dtedRecordSizeInBytes(0),
      m_edition(),
      m_productLevel(),
      m_compilationDate(),
      m_offsetToFirstDataRecord(0),
      m_latSpacing(0.0),
      m_lonSpacing(0.0),
      m_swCornerPost(),
      m_swapBytesFlag(false)
{

   static const char MODULE[] = "ossimDtedHandler (Filename) Constructor";
   if (traceExec())
   {
      ossimNotify(ossimNotifyLevel_DEBUG)
         << "DEBUG " << MODULE <<": entering..." << std::endl;
   }
   
   m_swapBytesFlag = ossim::byteOrder() == OSSIM_LITTLE_ENDIAN ? true : false;
   //---
   //  Open the dted file for reading.
   //---
   if (!open(dted_file, memoryMapFlag))
   {
      theErrorStatus = ossimErrorCodes::OSSIM_ERROR;
      
      if (traceDebug())
      {
         ossimNotify(ossimNotifyLevel_FATAL)
            << "FATAL " << MODULE << ": "
            << "\nCould not open file:  " << dted_file.c_str()
            << "\nReturning..." << std::endl;
         ossimNotify(ossimNotifyLevel_DEBUG)
            << "DEBUG " << MODULE << ": returning with error..." << std::endl;
      }
      return;
   }
   else
   {
      if (traceDebug())
      {
         ossimNotify(ossimNotifyLevel_DEBUG)
            << "DEBUG " << MODULE <<": Loading dted file: " << dted_file
            << std::endl;
      }
   }

   // DTED is stored in big endian.
   if (traceExec())
   {
      ossimNotify(ossimNotifyLevel_DEBUG)
         << "DEBUG " << MODULE << ": returning..." << std::endl;
   }
}
Esempio n. 9
0
// Note: throws ossimException on error.
void ossimRpfUtil::writeDotRpfFiles( const ossimFilename& aDotTocFile,
                                     const ossimFilename& outputDir )
{
   static const char MODULE[] = "ossimRpfUtil::writeDotRpfFiles";

   if ( traceDebug() )
   {
      ossimNotify(ossimNotifyLevel_DEBUG)
         << MODULE << " entered..."
         << "\na.toc file:        " << aDotTocFile
         << "\noutput directory:  " << outputDir
         << "\n";
   }
   
   // Parse the a.toc file:
   ossimRefPtr<ossimRpfToc> toc = new ossimRpfToc();
   
   if ( toc->parseFile(aDotTocFile) != ossimErrorCodes::OSSIM_OK )
   {
      std::string e = MODULE;
      e += " ERROR:\nCould not open: ";
      e+= aDotTocFile.string();
      throw ossimException(e);
   }

   if ( outputDir.expand().exists() == false )
   {
      if ( !outputDir.createDirectory(true, 0775) )
      {
         std::string e = MODULE;
         e += " ERROR:\nCould not create directory: ";
         e+= outputDir.c_str();
         throw ossimException(e);
      }
   }

   //---
   // Go through the entries...
   //---
   ossim_uint32 entries = toc->getNumberOfEntries();
   for (ossim_uint32 entry = 0; entry < entries; ++entry)
   {
      const ossimRpfTocEntry* tocEntry = toc->getTocEntry(entry);
      if (tocEntry)
      {
         if ( tocEntry->isEmpty() == false )
         {
            writeDotRpfFile(toc.get(), tocEntry, outputDir, entry);
         }
      }
      else
      {
         std::string e = MODULE;
         e += " ERROR:  Null entry: ";
         e += ossimString::toString(entry).string();
         throw ossimException(e);
      }
   }
   
} // End: ossimRpfUtil::writeDotRpfFiles
Esempio n. 10
0
//*******************************************************************
// Private Method:
//*******************************************************************
bool ossimKeywordlist::parseFile(const ossimFilename& file,
                                 bool ignoreBinaryChars)
{
   std::ifstream is;
   is.open(file.c_str(), std::ios::in | std::ios::binary);

   if ( !is.is_open() )
   {
      // ESH 07/2008, Trac #234: OSSIM is case sensitive 
      // when using worldfile templates during ingest
      // -- If first you don't succeed with the user-specified
      // filename, try again with the results of a case insensitive search.
      ossimDirectory directory(file.path());
      ossimFilename filename(file.file());

      std::vector<ossimFilename> result;
      bool bSuccess = directory.findCaseInsensitiveEquivalents( filename, result );
      if ( bSuccess == true )
      {
         int numResults = (int)result.size();
         int i;
         for ( i=0; i<numResults && !is.is_open(); ++i )
         {
            is.open( result[i].c_str(), std::ios::in | std::ios::binary );
         }
      }

      if ( !is.is_open() )
      {
         if ( traceDebug() ) 
         {
            // report all errors that aren't existence problems.
            // we want to know about things like permissions, too many open files, etc.
            ossimNotify(ossimNotifyLevel_DEBUG)
            << "Error opening file: " << file.c_str() << std::endl;
         }
         return false;
      }
   }

   bool result = parseStream(is, ignoreBinaryChars);

   is.close();

   return result;
}
Esempio n. 11
0
void ossimIndexToRgbLutFilter::setLut(const ossimFilename& file)
{
   theLutFile = file;
   if(file.exists())
   {
      ossimKeywordlist kwl(file.c_str());
      loadState(kwl);
   }
}
Esempio n. 12
0
ossimGeneralRasterElevHandler::ossimGeneralRasterElevHandler(const ossimFilename& file)
   :ossimElevCellHandler(file.c_str()),
    m_streamOpen(false)
{
   if(!open(file))
   {
      setErrorStatus();
   }
}
bool ossimMultiResLevelHistogram::importHistogram(const ossimFilename& file)
{
   if( file.fileSize() > 0 )
   {
      theHistogramFile = file;
      
      ifstream input(file.c_str());
      return importHistogram(input);
   }
   return false;
}
void ossimQtSingleImageWindow::displayImage(const ossimFilename& file)
{
    ossimRefPtr<ossimImageHandler> ih = ossimImageHandlerRegistry::instance()->open(file);
    if (!ih)
    {
        QString caption = "Sorry:";
        QString text = "Could not find the image handler for file:\n";
        text += file.c_str();
        QMessageBox::information( this,
                                  caption,
                                  text,
                                  QMessageBox::Ok );
        return;
    }

    if (ih->getNumberOfDecimationLevels() == 1)
    {
        QString caption("Question:");
        QString text = "Would you like to build reduced resolution data sets?\n";
        text += "Note:\n";
        text += "This can take some time depending on the size of your image.";
        text += "\nAlternatively use the command line application:  \"img2rr\"";

        int answer = QMessageBox::question( this,
                                            caption,
                                            text,
                                            QMessageBox::Yes,
                                            QMessageBox::No);
        if (answer == QMessageBox::Yes)
        {
            //---
            // We need to listen for the open overview signal to rebuild the
            // theResolutionLevelMenu.
            //---
            ih->addListener(this);
            buildOverViews( ih.get() );
        }
    }

    createImageChain( ih.get() );

    // Build the resolution level menu.
    buildResolutionLevelMenu();

    // Give it to the widget.
    theImageWidget->connectMyInputTo(theImageChain.get());
    theImageWidget->refresh();

    connectMyInputTo(theImageChain.get());
    QString caption = "iview : ";
    caption += file.file().c_str();
    setCaption(caption);
}
Esempio n. 15
0
void get_elevation(ossimFilename infile, ossimFilename outfile, ossimFilename elevationPath="D:\\workspace\\ossimdem")
{
	FILE *pfIn = fopen(infile.c_str(), "r+" );
	FILE *pfOut = fopen(outfile.c_str(), "w+");

	ossimElevManager* theElevManager = ossimElevManager::instance();
	theElevManager->loadElevationPath(elevationPath);
	int id;
	double L2Line, L2Sample;
	double Lon, Lat;
	double Hgt;
	int index = 1;
	while (EOF != fscanf(pfIn, "%d%lf%lf%lf%lf%lf", &id, &L2Line, &L2Sample, &Lon, &Lat, &Hgt))
	{
		//ossimGpt gpt(Lon, Lat, Hgt);
		ossimGpt gpt(Lat, Lon, Hgt);
		Hgt = ossimElevManager::instance()->getHeightAboveEllipsoid(gpt);
		fprintf(pfOut, "%6d%20.9lf%20.9lf%20.9lf%20.9lf%20.9lf\n", index++, L2Line, L2Sample, Lon, Lat, Hgt);
	}
	fclose(pfIn);
	fclose(pfOut);
}
Esempio n. 16
0
bool ossimLasInfo::open(const ossimFilename& file)
{
    bool result = false;
    std::ifstream istr;
    istr.open(file.c_str(), std::ios_base::in | std::ios_base::binary);
    if ( istr.is_open() )
    {
        ossimLasHdr hdr;
        result = hdr.checkSignature(istr);
        if (result) m_file = file;
    }
    return result;
}
Esempio n. 17
0
bool ossimShorelineUtil::initialize(ossimArgumentParser& ap)
{
   if (!ossimChipProcUtil::initialize(ap))
      return false;

   string ts1;
   ossimArgumentParser::ossimParameter sp1(ts1);
   string ts2;
   ossimArgumentParser::ossimParameter sp2(ts2);
   string ts3;
   ossimArgumentParser::ossimParameter sp3(ts3);

   if ( ap.read("--algorithm", sp1))
      m_kwl.addPair(ALGORITHM_KW, ts1);

   if (ap.read("--color-coding", sp1, sp2, sp3))
   {
      ostringstream value;
      value<<ts1<<" "<<ts2<<" "<<ts3;
      m_kwl.addPair( COLOR_CODING_KW, value.str() );
   }

   if ( ap.read("--edge"))
      m_kwl.addPair(DO_EDGE_DETECT_KW, string("true"));

   if ( ap.read("--raster"))
      m_kwl.addPair(RASTER_KW, string("true"));

   if ( ap.read("--sensor", sp1))
      m_kwl.addPair(ossimKeywordNames::SENSOR_ID_KW, ts1);

   if ( ap.read("--sigma", sp1))
      m_kwl.addPair(SIGMA_KW, ts1);

   if ( ap.read("--smooth", sp1))
      m_kwl.addPair(SMOOTHING_KW, ts1);

   if ( ap.read("--threshold", sp1))
      m_kwl.addPair(THRESHOLD_KW, ts1);

   if ( ap.read("--tolerance", sp1))
      m_kwl.addPair(TOLERANCE_KW, ts1);

   // Fake the base class into thinking there is a default output filename to avoid it complaining,
   // since this utility will stream vector output to console if no output file name provided:
   m_kwl.add( ossimKeywordNames::OUTPUT_FILE_KW, DUMMY_OUTPUT_FILENAME.c_str());

   processRemainingArgs(ap);
   return true;
}
Esempio n. 18
0
bool ossimShapeFile::open(const ossimFilename& file,
                          const ossimString& flags)
{
   if(isOpen()) close();
   
   theHandle = SHPOpen( file.c_str(),
                        flags.c_str());
   if(isOpen())
   {
      theFilename = file;
   }
   
   return (theHandle != NULL);
}
Esempio n. 19
0
bool ossimSensorModelFactory::isNitf(const ossimFilename& filename)const
{
   std::ifstream in(filename.c_str(), ios::in|ios::binary);
   
   if(in)
   {
      char nitfFile[4];
      in.read((char*)nitfFile, 4);

      return (ossimString(nitfFile,
                          nitfFile+4) == "NITF");
   }

   return false;
}
Esempio n. 20
0
bool ossimXmlDocument::write(const ossimFilename& file)
{
   std::ofstream out(file.c_str());

   if(out)
   {
      out << *this << std::endl;
   }
   else
   {
      return false;
   }

   return true;
}
Esempio n. 21
0
//**************************************************************************
// CONSTRUCTOR
//**************************************************************************
ossimDtedUhl::ossimDtedUhl(const ossimFilename& dted_file, ossim_int32 offset)
   :
      theRecSen(),
      theField2(),
      theLonOrigin(),
      theLatOrigin(),
      theLonInterval(),
      theLatInterval(),
      theAbsoluteLE(),
      theSecurityCode(),
      theNumLonLines(),
      theNumLatPoints(),
      theMultipleAccuracy(),
      theStartOffset(0),
      theStopOffset(0)
{
   if(!dted_file.empty())
   {
      // Check to see that dted file exists.
      if(!dted_file.exists())
      {
         theErrorStatus = ossimErrorCodes::OSSIM_ERROR;
         ossimNotify(ossimNotifyLevel_FATAL) << "FATAL ossimDtedUhl::ossimDtedUhl: The DTED file does not exist: " << dted_file << std::endl;
         return;
      }
      
      // Check to see that the dted file is readable.
      if(!dted_file.isReadable())
      {
         theErrorStatus = ossimErrorCodes::OSSIM_ERROR;
         ossimNotify(ossimNotifyLevel_FATAL) << "FATAL ossimDtedUhl::ossimDtedUhl: The DTED file is not readable --> " << dted_file << std::endl;
         return;
      }
      
      std::ifstream in(dted_file.c_str());
      if(!in)
      {
         theErrorStatus = ossimErrorCodes::OSSIM_ERROR;
         ossimNotify(ossimNotifyLevel_FATAL) << "FATAL ossimDtedUhl::ossimDtedUhl: Error opening the DTED file: " << dted_file << std::endl;
         
         return;
      }
      in.seekg(offset);
      parse(in);
      
      in.close();
   }
}
Esempio n. 22
0
bool ossimNitfProjectionFactory::isNitf(const ossimFilename& filename)const
{
   std::ifstream in(filename.c_str(), ios::in|ios::binary);
   
   if(in)
   {
      char nitfFile[4];
      in.read((char*)nitfFile, 4);
      ossimString s(nitfFile, nitfFile+4);
      if ( (s == "NITF") || (s == "NSIF") )
      {
         return true;
      }
   }

   return false;
}
Esempio n. 23
0
//*******************************************************************
// Private Method:
//*******************************************************************
bool ossimKeywordlist::parseFile(const ossimFilename& file,
                                 bool ignoreBinaryChars)
{
   if(!file.exists()) return false;
   bool result = false;
   std::ifstream is;
   is.open(file.c_str(), std::ios::in | std::ios::binary);
   
   if(!is.fail())
   {
      result = parseStream(is, ignoreBinaryChars);
   }
   
   is.close();
   
   return result;
}
Esempio n. 24
0
bool ossimJ2kInfo::open(const ossimFilename& file)
{
   bool result = false;

   //---
   // Open the file.
   //---
   std::ifstream str(file.c_str(), std::ios_base::binary|std::ios_base::in);
   if (str.good()) 
   {
      //---
      // Check for the Start Of Codestream (SOC) and Size (SIZ) markers which
      // are required as first and second fields in the main header.
      //---
      ossim_uint16 soc;
      ossim_uint16 siz;
      readUInt16(soc, str);
      readUInt16(siz, str);

      const ossim_uint16 SOC_MARKER = 0xff4f; // start of codestream marker
      const ossim_uint16 SIZ_MARKER = 0xff51; // size maker
      
      if ( (soc == SOC_MARKER) && (siz == SIZ_MARKER) )
      {
         result = true; // Is a j2k...
      }
   }

   if (result)
   {
      
      m_file = file;
   }
   else
   {
      m_file.clear();
      if (m_endian)
      {
         delete m_endian;
         m_endian = 0;
      }
   }

   return result;
}
Esempio n. 25
0
void ossimEquationUtil::outputTemplateKeywordlist(const ossimFilename &templateFilename)
{
   ofstream out(templateFilename.c_str());

   out << "file1.filename: <full path and file name>" << endl
       << "file2.filename: <full path and file name>" << endl
       << "// :\n"
       << "// :\n"
       << "// fileN.filename:: <full path and file name>" << endl
       << "\n// currently this option has been tested\n"
       << "// with ossimTiffWriter and ossimJpegWriter\n"
       << "writer.type: tiff_strip"            << endl
       << "writer.filename: <full path to output file>"  << endl
       << "\n// Equation specification:\n"
       << "equation: <equation spec string>"<<endl;

   ossimNotify(ossimNotifyLevel_NOTICE) << "Wrote file: " << templateFilename << std::endl;
}
Esempio n. 26
0
//**************************************************************************
// CONSTRUCTOR
//**************************************************************************
ossimDtedVol::ossimDtedVol(const ossimFilename& dted_file,
                           ossim_int32 offset)
   :
      theStartOffset(0),
      theStopOffset(0)
{
   if(!dted_file.empty())
   {
      // Check to see that dted file exists.
      if(!dted_file.exists())
      {
         theErrorStatus = ossimErrorCodes::OSSIM_ERROR;
         ossimNotify(ossimNotifyLevel_FATAL)
         << "FATAL ossimDtedVol::ossimDtedVol"
         << "\nThe DTED file does not exist: " << dted_file << std::endl;
         return;
      }
      
      // Check to see that the dted file is readable.
      if(!dted_file.isReadable())
      {
         theErrorStatus = ossimErrorCodes::OSSIM_ERROR;
         ossimNotify(ossimNotifyLevel_FATAL)
         << "FATAL ossimDtedVol::ossimDtedVol"
         << "\nThe DTED file is not readable: " << dted_file << std::endl;
         return;
      }
      
      // Open the dted file for reading.
      std::ifstream in(dted_file.c_str());
      if(!in)
      {
         theErrorStatus = ossimErrorCodes::OSSIM_ERROR;
         ossimNotify(ossimNotifyLevel_FATAL)
         << "FATAL ossimDtedVol::ossimDtedVol"
         << "\nUnable to open the DTED file: " << dted_file << std::endl;
         return;
      }
      in.seekg(offset);
      parse(in);
      
      in.close();
   }
}
void ossimGui::HistogramRemapperEditor::setHistogram(const ossimFilename& file)
{
    if(!m_histogramRemapper.valid()) return;

    if(m_histogramRemapper->openHistogram(file))
    {

        initializeUiValues();
        populateClipPoints();
        fireRefreshEvent();
    }
    else
    {
        QMessageBox::warning(this,
                             tr("My Application"),
                             tr("Unable to open histogram file") + file.c_str(),
                             QMessageBox::Ok);
    }
}
Esempio n. 28
0
std::shared_ptr<ossim::ifstream> ossimStreamFactory::createIFStream(
   const ossimFilename& file, std::ios_base::openmode openMode) const
{
   std::shared_ptr<ossim::ifstream> result(0);

   if ( file.exists() )
   {
      // there is a bug in gcc < 5.0 and we can't use constructors in the 
      // C++11 build.  Will refactor to do a new ifstream then use open
      //
      result = std::make_shared<ossim::ifstream>();
      result->open(file.c_str(), openMode);
      if ( result->is_open() == false )
      {
         result.reset();
      }
   }
   return result;
}
Esempio n. 29
0
ossimRefPtr<ossimProjection> ossimAuxXmlSupportData::getProjection(const ossimFilename& file) const
{
   ossimRefPtr<ossimProjection> result = 0;

   std::ifstream is(file.c_str(), std::ios_base::binary|std::ios_base::in);

   if ( is.good() )
   {
      // Read the xml document:
      ossimXmlDocument xdoc;
      if ( xdoc.read( is ) )
      {
         // Get the WKT string
         ossimString wkt;
         ossimString path = "/PAMDataset/Metadata/GeodataXform/SpatialReference/WKT";
         if ( getPath( path, xdoc, wkt ) )
         {
            if ( wkt.size() )
            {
               // Substitute "&quot;":
               ossimString tmpWkt = wkt.substitute( ossimString("&quot;"), ossimString(""), true );
               
               ossimString name;
               if ( getProjcsName( tmpWkt.string(), name.string() ) )
               {
                  result = ossimProjectionFactoryRegistry::instance()->createProjection( name );
                  if ( result.valid() )
                  {
                     if ( initializeProjection( xdoc, tmpWkt.string(), result.get() ) == false )
                     {
                        // Zero out the result if tie or scale not set.
                        result = 0;
                     }
                  }
               }
            }
         }
      }  
   }
   
   return result;
   
} // End: ossimAuxXmlSupportData::getProjection
bool ossimTiffProjectionFactory::isTiff(const ossimFilename& filename)const
{
   std::ifstream in;
   unsigned char header[2];

   in.open( filename.c_str(), ios::in|ios::binary);
   if( !in)
       return false;

   in.read( (char*)header, 2);

   if( (header[0] != 'M' || header[1] != 'M')
       && (header[0] != 'I' || header[1] != 'I') )
   {
      return false;
   }

   return true;
}