91 preferencesKWL().findKey( std::string(
"ossim_share_directory" ) );
96 findKey( std::string(
"wkt_database_file" ) );
98 if ( wkt_path.
size() )
108 else if ( share_dir.
size() )
115 db_name = share_dir.
dirCat( wkt_path );
124 db_name = db_name.
dirCat( wkt_path);
130 db_name = db_name.
dirCat( wkt_path);
145 bool good_file =
false;
146 if (db_stream.good())
151 if (format_id == WKT_MAGIC)
157 <<
"ossimWktProjectionDatabase::loadRecords() -- Encountered bad WKT database file <" 158 << db_name <<
">. Skipping this file." << endl;
167 while (!db_stream.eof())
170 std::vector<ossimString> csvRecord = line.
explode(
",");
171 if (csvRecord.size())
173 std::pair<std::string, ossim_uint32> projRecord;
174 projRecord.first = csvRecord[1].string();
175 projRecord.second = csvRecord[0].toUInt32();
207 const char *prefix)
const 217 if (pcs_name.
empty())
236 ossimString auth_name = temp_kwl.
find(prefix,
"PROJCS.AUTHORITY.name");
237 if (auth_name ==
"EPSG")
238 epsg_code = temp_kwl.
find(prefix,
"PROJCS.AUTHORITY.param0");
242 if (!epsg_code.
empty())
253 ossimString proj_name = temp_kwl.
find(prefix,
"PROJCS.PROJECTION.name");
254 if (proj_name.
empty())
257 proj_name.
gsub(
" ",
"_",
true);
260 if (proj_name.
contains(
"transverse_mercator"))
262 else if (proj_name.
contains(
"mercator"))
264 else if (proj_name.
contains(
"lambert"))
266 else if (proj_name.
contains(
"equirectangular"))
268 else if (proj_name.
contains(
"cylindrical_equal_area"))
305 const char* prefix)
const 328 std::map<std::string, ossim_uint32>::iterator db_iter =
m_wktProjRecords.begin();
340 doMapCommon<ossimTransMercatorProjection*>(kwl, proj);
352 name_read = kwl.find(param +
".name");
353 val_read = kwl.
find(param +
".param0");
355 if (name_read.contains(
"scale_factor"))
361 }
while (!name_read.empty());
369 doMapCommon<ossimMercatorProjection*>(kwl, proj);
381 name_read = kwl.find(param +
".name");
382 val_read = kwl.
find(param +
".param0");
384 if (name_read.contains(
"scale_factor"))
390 }
while (!name_read.empty());
398 doMapCommon<ossimLambertConformalConicProjection*>(kwl, proj);
410 name_read = kwl.find(param +
".name");
411 val_read = kwl.
find(param +
".param0");
413 if (name_read.contains(
"standard_parallel_1"))
416 else if (name_read.contains(
"standard_parallel_2"))
419 }
while (!name_read.empty());
427 doMapCommon<ossimEquDistCylProjection*>(kwl, proj);
435 doMapCommon<ossimCylEquAreaProjection*>(kwl, proj);
447 name_read = kwl.
find(
"PROJCS.GEOGCS.AUTHORITY.name");
448 val_read = kwl.
find(
"PROJCS.GEOGCS.AUTHORITY.param0");
449 if ((name_read ==
"EPSG") && (!val_read.
empty()))
453 proj->setDatum(datum);
458 name_read = kwl.
find(
"PROJCS.UNIT.name");
459 double conv_factor = 1.0;
473 name_read = kwl.
find(param +
".name");
474 val_read = kwl.
find(param +
".param0");
476 if (name_read.
contains(
"central_meridian"))
479 else if (name_read.
contains(
"latitude_of_origin"))
482 else if (name_read.
contains(
"false_easting"))
483 proj->setFalseEasting(val_read.
toDouble() * conv_factor);
485 else if (name_read.
contains(
"false_northing"))
486 proj->setFalseNorthing(val_read.
toDouble() * conv_factor);
488 }
while (!name_read.
empty());
490 proj->setOrigin(origin);
const ossimKeywordlist & preferencesKWL() const
ossimProjection * doEquiAreaCylindrical(const ossimKeywordlist &kwl) const
virtual void getTypeNameList(std::vector< ossimString > &typeList) const
This returns the type name of all objects in all factories.
void stripPrefixFromAll(const ossimString ®ularExpression)
Represents serializable keyword/value map.
std::basic_ifstream< char > ifstream
Class for char input file streams.
const char * find(const char *key) const
Projection Factory for coded projections defined in database.
void setScaleFactor(double scaleFactor)
void doMapCommon(const ossimKeywordlist &kwl, T proj) const
bool contains(char aChar) const
std::map< std::string, ossim_uint32 > m_wktProjRecords
static ossimWktProjectionFactory * m_instance
Singleton implementation.
static ossimString toString(bool aValue)
Numeric to string methods.
ossim_uint32 toUInt32() const
std::istream & getline(std::istream &is, ossimString &str, char delim)
virtual ossim_uint32 getCode(const ossimString &name)
virtual const ossimDatum * create(const ossimString &epsg_spec) const
Creates a datum instance given an EPSG spec in the form "EPSG:<datum_code>".
virtual ossimProjection * createProjection(const ossimFilename &filename, ossim_uint32 entryIdx) const
STUB. Not implemented.
std::string::size_type size() const
static ossimEpsgProjectionDatabase * instance()
Instantiates singleton instance of this class:
void setScaleFactor(double scaleFactor)
unsigned int ossim_uint32
const char * chars() const
For backward compatibility.
ossimString trim(const ossimString &valueToTrim=ossimString(" \\)) const
this will strip lead and trailing character passed in.
virtual ossimObject * createObject(const ossimString &typeName) const
Utility/support data class to parse WKT text string to an ossimKeywordlist.
void loadRecords() const
Loads all SRS CSV files specified in the ossim prefs.
static ossimEpsgDatumFactory * instance()
Singleton implementation.
static ossimString downcase(const ossimString &aString)
std::vector< ossimString > explode(const ossimString &delimeter) const
static ossimPreferences * instance()
ossimProjection * doLambertConformalConic(const ossimKeywordlist &kwl) const
bool isRelative() const
Checks whether file name is relative or absolute.
ossimFilename dirCat(const ossimFilename &file) const
ossimProjection * doEquiDistCylindrical(const ossimKeywordlist &kwl) const
ossimString & gsub(const ossimString &searchKey, const ossimString &replacementValue, bool replaceAll=false)
Substitutes searchKey string with replacementValue and returns a reference to *this.
bool parse(const std::string &wkt)
Parses string to keyword list.
const ossimKeywordlist & getKwl() const
ossimWktProjectionFactory()
Constructor loads the WKT CSV file specified in the ossim prefs with "wkt_database_file" keyword...
ossimProjection * doMercator(const ossimKeywordlist &kwl) const
ossimProjection * doTransverseMercator(const ossimKeywordlist &kwl) const
std::string::size_type find(const std::string &s, std::string::size_type pos=0) const
Searches for s as a substring of *this, beginning at character pos of *this.
static ossimWktProjectionFactory * instance()
Implements singleton pattern.
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
ossimProjection * findProjection(const ossimString &proj_spec) const
Returns a projection corresponding to the projection specified, or NULL if no entry found...
const std::string & string() const