30 static const std::string ALTITUDE_DISTANCE_UNITS_KW =
"altitude_distance_units";
31 static const std::string FGDC_FILE_KW =
"fgdc_file";
32 static const std::string FGDC_VERSION_KW =
"fgdc_version";
33 static const std::string FGDC_VERSION_001_1998 =
"FGDC-STD-001-1998";
54 std::string key =
"Metadata_Standard_Version";
56 if (
findKey( str,
true, key, value ) )
58 if ( value == FGDC_VERSION_001_1998 )
65 key =
"Altitude_Distance_Units";
66 if (
findKey( str,
false, key, value ) )
84 static const char M[] =
"ossimFgdcTxtDoc::getProjection";
97 if ( version == FGDC_VERSION_001_1998)
104 std::string key =
"Spatial_Reference_Information:";
127 static const char M[] =
"ossimFgdcTxtDoc::getProjectionV1";
130 std::string fgdcValue;
135 fgdcKey =
"Grid_Coordinate_System_Name";
136 if (
findKey( str,
true, fgdcKey, fgdcValue ) )
138 if ( fgdcValue ==
"Universal Transverse Mercator" )
141 value =
"ossimUtmProjection";
142 projectionKwl.
addPair(key, value);
145 fgdcKey =
"UTM_Zone_Number";
146 if (
findKey( str,
true, fgdcKey, fgdcValue ) )
150 projectionKwl.
addPair(key, value);
154 std::string errMsg = M;
155 errMsg +=
" ERROR: Could not determine utm zone!";
160 fgdcKey =
"False_Northing";
161 if (
findKey( str,
true, fgdcKey, fgdcValue ) )
175 projectionKwl.
addPair(key, value);
182 std::string errMsg = M;
183 errMsg +=
"ERROR: Unhandled projection: ";
188 fgdcKey =
"Horizontal_Datum_Name";
189 if (
findKey( str,
true, fgdcKey, fgdcValue ) )
193 projectionKwl.
addPair(key, value);
220 if ( line.
string() == key )
231 std::ifstream& str,
bool seekBack,
const std::string& key, std::string& value)
235 std::vector<ossimString> fgdcKeyValue;
239 std::streampos currentPosition = str.tellg();
252 fgdcKeyValue.
clear();
253 line.
split(fgdcKeyValue, separator,
false);
254 if ( fgdcKeyValue.size() == 2 )
256 fgdcKeyValue[0].trim();
258 if ( fgdcKeyValue[0].
size() )
260 if ( fgdcKeyValue[0] == key )
264 fgdcKeyValue[1].trim();
265 value = fgdcKeyValue[1].string();
275 str.seekg(currentPosition);
283 std::string& ossimDatumCode )
const 287 if ( horizdn ==
"north american datum of 1983" )
289 ossimDatumCode =
"NAR-C";
291 else if ( horizdn ==
"north american datum of 1927" )
293 ossimDatumCode =
"NAS-C";
295 else if ( horizdn ==
"wgs84")
297 ossimDatumCode =
"WGE";
302 std::string errMsg =
"ossimFgdcTxtDoc::getOssimDatum ERROR: Unhandled datum: ";
303 errMsg += horizdn.
string();
virtual ossimProjection * createProjection(const ossimFilename &filename, ossim_uint32 entryIdx) const
takes a filename.
void clear()
Erases the entire container.
bool open(const ossimFilename &file)
open method.
Represents serializable keyword/value map.
const std::string & findKey(const std::string &key) const
Find methods that take std::string(s).
std::basic_ifstream< char > ifstream
Class for char input file streams.
static ossimMapProjectionFactory * instance()
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 getProjectionV1(std::ifstream &str, ossimRefPtr< ossimProjection > &proj)
Gets projection from Spatial_Reference_Information block for version FGDC-STD-001-1998.
void addPair(const std::string &key, const std::string &value, bool overwrite=true)
virtual ~ossimFgdcTxtDoc()
virtual destructor
std::istream & getline(std::istream &is, ossimString &str, char delim)
void close()
Close method.
void getOssimDatum(const std::string &fgdcDatumString, std::string &ossimDatumCode) const
Gets ossim datum string from fgdc datum string.
virtual const char * what() const
Returns the error message.
std::string::size_type size() const
ossimFgdcTxtDoc()
default constructor
ossimString trim(const ossimString &valueToTrim=ossimString(" \\)) const
this will strip lead and trailing character passed in.
ossim_float64 toFloat64() const
static ossimString downcase(const ossimString &aString)
void getProjection(ossimRefPtr< ossimProjection > &proj)
Gets projection from Spatial_Reference_Information block.
ossimRefPtr< ossimKeywordlist > m_kwl
ossim_uint32 getSize() const
const char * c_str() const
Returns a pointer to a null-terminated array of characters representing the string's contents...
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
bool findKey(std::ifstream &str, const std::string &key)
Finds key and returns true if present.
void getAltitudeDistanceUnits(std::string &units) const
Gets units from Altitude_Distance_Units.
const std::string & string() const