80 static const ossimString EPSG_DB_FORMAT_A (
"EPSG_DB_FORMAT_A");
102 static const ossimString STATE_PLANE_FORMAT_B (
"STATE_PLANE");
113 static const ossimString SPCS_EPSG_MAP_FORMAT_C (
"SPCS_EPSG_MAP");
124 if (sex_str.
chars()[0] ==
'-')
127 double dsex, msex, ssex;
128 std::vector<ossimString> splitstr = sex_str.
split(
".");
129 dsex = splitstr[0].toDouble();
131 if (splitstr.size() < 2)
134 const char* MMSSssstr = splitstr[1].chars();
135 unsigned int str_size = (
unsigned int) splitstr[1].
size();
136 char minstr[] =
"00";
138 minstr[0] = MMSSssstr[0];
141 minstr[1] = MMSSssstr[1];
144 secstr = &(MMSSssstr[2]);
147 else if (str_size > 4)
153 dsex +=
sign*(msex + ssex/60.0)/60.0;
197 preferencesKWL().findKey( std::string(
"ossim_share_directory" ) );
200 vector<ossimString> keys =
202 vector<ossimString>::const_iterator i = keys.begin();
212 while ( i != keys.end() )
216 if ( epsg_path.
size() )
226 else if ( share_dir.
size() )
233 db_name = share_dir.
dirCat( epsg_path );
242 db_name = db_name.
dirCat( epsg_path);
248 db_name = db_name.
dirCat( epsg_path);
262 bool good_file =
false;
263 if (db_stream.good())
268 if ((format_id == EPSG_DB_FORMAT_A) ||
269 (format_id == STATE_PLANE_FORMAT_B) ||
270 (format_id == SPCS_EPSG_MAP_FORMAT_C))
276 "Encountered bad database file <"<<db_name<<
">. Skipping this file."<<endl;
285 while (!db_stream.eof())
293 if (format_id == EPSG_DB_FORMAT_A)
302 else if (format_id == STATE_PLANE_FORMAT_B)
313 else if (format_id == SPCS_EPSG_MAP_FORMAT_C)
337 if ((epsg_code == 0) || (epsg_code == 32767))
341 else if (( epsg_code==3857) || (epsg_code == 900913))
370 std::multimap<ossim_uint32, ossimRefPtr<ProjDbRecord> >::iterator db_iter =
377 if ( db_record.
valid() )
387 db_record->
proj = proj;
390 else if (db_iter->second->csvFormat ==
FORMAT_A)
394 else if (db_iter->second->csvFormat ==
FORMAT_B)
431 spec_group = spec.
before(
":");
441 if ((spec_code != 0) && (spec_group ==
"epsg"))
448 vector<ossimString> split_spec = spec.
split(separators,
true);
449 vector<ossimString> split_db_name;
453 std::multimap<ossim_uint32, ossimRefPtr<ProjDbRecord> >::iterator db_iter =
m_projDatabase.begin();
457 if ( db_record.
valid() )
459 split_db_name.clear();
460 db_record->
name.
split(split_db_name, separators,
true);
461 if (split_spec == split_db_name)
498 std::multimap<ossim_uint32, ossimRefPtr<ProjDbRecord> >::iterator db_iter =
m_projDatabase.begin();
502 if ( db_record.
valid() )
504 if (db_record->
name == proj_name)
505 return (db_record->
code);
525 if ((lost_type ==
"ossimEquDistCylProjection") && (lost_proj.
getDatum()->
epsgCode() == 6326))
529 if (lost_type ==
"ossimUtmProjection")
539 std::multimap<ossim_uint32, ossimRefPtr<ProjDbRecord> >::iterator db_iter =
544 if ( db_record.
valid() )
555 found_code = db_record->
code;
560 if (found_code == 4087)
579 std::multimap<ossim_uint32, ossimRefPtr<ProjDbRecord> >::iterator db_iter =
583 name = db_iter->second->name;
599 std::multimap<ossim_uint32, ossimRefPtr<ProjDbRecord> >::iterator db_iter =
m_projDatabase.begin();
603 if ( db_record.
valid() )
608 record += db_record->
name;
634 double mtrs_per_unit = 1.0;
648 mtrs_per_unit = 1000.0;
671 if (proj_type.
contains(
"Transverse Mercator"))
680 else if (proj_type.
contains(
"Lambert Conic Conformal (1SP)"))
689 else if (proj_type.
contains(
"Lambert Conic Conformal (2SP)"))
699 else if (proj_type.
contains(
"Cassini"))
707 else if (proj_type.
contains(
"Mercator (1SP)"))
716 else if(proj_type.
contains(
"Popular Visualisation Sphere"))
729 else if(proj_type.
contains(
"Pseudo Mercator"))
737 else if (proj_type.
contains(
"Albers"))
747 else if (proj_type.
contains(
"Equidistant Cylindrical"))
755 else if (proj_type.
contains(
"New Zealand Map Grid"))
764 record->
proj = nz_proj;
766 else if (proj_type.
contains(
"Polar Stereographic"))
773 record->
proj = ups_proj;
818 info.populateProjectionKeywords(kwl);
848 if ( (zone > 0 ) && (zone < 61) )
859 if ( (zone > 0) && (zone < 61) )
870 if ( (zone > 0) && (zone < 61) )
881 if ( (zone > 0) && (zone < 61) )
895 if ( (code > 26702) && (code < 26723) )
909 if ( (code > 26902) && (code < 26924) )
921 if ( (code > 24817) && (code < 24881) )
959 if ((zone < 1 ) || (zone > 60))
963 if ((hemisphere ==
'N') && (datum_code ==
"WGD"))
966 else if ((hemisphere ==
'S') && (datum_code ==
"WGD"))
969 else if ((hemisphere ==
'N') && (datum_code ==
"WGE"))
972 else if ((hemisphere ==
'S') && (datum_code ==
"WGE"))
975 else if ((hemisphere ==
'N') && (datum_code ==
"NAS-C") && (zone > 2) && (zone < 23))
978 else if ((hemisphere ==
'N') && (datum_code ==
"NAR-C") && (zone > 2) && (zone < 24))
981 else if ((hemisphere ==
'N') && (datum_code ==
"PRP-M"))
984 else if ((hemisphere ==
'S') && (datum_code ==
"PRP-M"))
985 epsg_code += 24800 + 60;
993 if ( hemisphere ==
'N' )
virtual const ossimDatum * create(const ossimString &code) const
create method
ossim_uint32 getCodeFromUtmProj(const ossimUtmProjection *proj) const
Given UTM projection, derives the associated EPSG code. This is faster than a Db lookup.
void clear()
Erases the entire container.
const ossimKeywordlist & preferencesKWL() const
virtual ossimObject * dup() const =0
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...
Real sign(Real x, Real y)
bool datumValid
FALSE if the datum code was not parsed and WGS84 defaulted.
Type for database record consists of EPSG code and serialized form of corresponding OSSIM projection ...
Represents serializable keyword/value map.
const std::string & findKey(const std::string &key) const
Find methods that take std::string(s).
void initialize() const
Populates the database with contents of DB files as specified in ossim_preferences.
std::string & insert(std::string::size_type pos, const char *s)
If pos > size(), throws out_of_range.
static ossimDatumFactoryRegistry * instance()
instance method
std::basic_ifstream< char > ifstream
Class for char input file streams.
std::vector< ossimString > csvRecord
virtual ossim_uint32 epsgCode() const
static ossimMapProjectionFactory * instance()
virtual void setOrigin(const ossimGpt &origin)
Sets theOrigin to origin.
bool contains(char aChar) const
void setFalseEastingNorthing(double falseEasting, double falseNorthing)
virtual const ossimString & code() const
static ossimString toString(bool aValue)
Numeric to string methods.
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.
Projection Database for coded projections defined in database files and specified via some coordinate...
virtual ossimString getClassName() const
ossim_uint32 toUInt32() const
std::istream & getline(std::istream &is, ossimString &str, char delim)
ossim_uint32 findProjectionCode(const ossimString &projection_name) const
Given a projection name, assigns the group (e.g., "EPSG") and code of the projection.
void getProjectionsList(std::vector< ossimString > &typeList) const
Populates caller's list with all projections currently represented in the database.
ossimMapProjection * createProjFromUtmCode(ossim_uint32 code) const
HACKUTM projections as specified in the EPSG are indistinguishable from regular TM.
void push_back(char c)
Equivalent to insert(end(), c).
Albers Equal Area Conic Projection.
virtual const ossimDatum * getDatum() const
virtual const ossimDatum * create(const ossimString &epsg_spec) const
Creates a datum instance given an EPSG spec in the form "EPSG:<datum_code>".
virtual void setPcsCode(ossim_uint32 pcsCode)
std::string::size_type size() const
static ossimEpsgProjectionDatabase * instance()
Instantiates singleton instance of this class:
ossimMapProjection * createProjFromFormatBRecord(ProjDbRecord *record) const
Parses the State Plane Db record format and produce a projection (or NULL if invalid) ...
unsigned int ossim_uint32
virtual const ossimDatum * create(const ossimString &code) const
create method
const char * chars() const
For backward compatibility.
ossimString trim(const ossimString &valueToTrim=ossimString(" \\)) const
this will strip lead and trailing character passed in.
virtual const ossimEllipsoid * ellipsoid() const
static ossimDatumFactory * instance()
static ossimEpsgDatumFactory * instance()
Singleton implementation.
static ossimString downcase(const ossimString &aString)
std::vector< ossimString > explode(const ossimString &delimeter) const
static ossimPreferences * instance()
void setZone(const ossimGpt &ground)
std::vector< ossimString > getSubstringKeyList(const ossimString ®ularExpression) const
std::multimap< ossim_uint32, ossimRefPtr< ProjDbRecord > > m_projDatabase
static const char * PCS_CODE_KW
virtual ~ossimEpsgProjectionDatabase()
Destructor.
bool isRelative() const
Checks whether file name is relative or absolute.
ossimFilename dirCat(const ossimFilename &file) const
ossimMapProjection * createProjFromFormatARecord(ProjDbRecord *record) const
Parses the "Spadac EPSG" Db record format and produces a projection (or NULL if invalid) ...
ossim_int32 getZone() const
double decodeSexagesimalDms(const ossimString &sex_str)
Converts sexagesimal DMS to decimal degrees.
char getHemisphere() const
void setProjectionUnits(ossimUnitType units)
virtual void setDatum(const ossimDatum *datum)
Sets theDatum to datum.
ossimString after(const ossimString &str, std::string::size_type pos=0) const
METHOD: after(str, pos) Returns string immediately after the token str.
ossimString findProjectionName(ossim_uint32 epsg_code) const
NECESSARY HACK ### (originally implemented by ESH)ArcMap (9.2 and less) doesn't understand the non-me...
void setHemisphere(const ossimGpt &ground)
void remove(const char *key)
ossimRefPtr< ossimMapProjection > proj
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...
ossimEpsgProjectionDatabase()
Constructor loads all Db files specified in the ossim prefs.
const std::string & string() const