Skip to content
Snippets Groups Projects
Commit e1f79b5d authored by Emmanuel Christophe's avatar Emmanuel Christophe
Browse files

BUG: ossim OgcWkt and ossimEquDistCylProjection

switched the ossimOgcToWktTranslator.cpp back to the official version and added a verification in GenericMapProjection, not to instanciate the ossimEquDistCylProjection. This is a clean fix but the problem could be in ossim, in OTB or in the shapefile used.
parent 801d2fbf
Branches
Tags
No related merge requests found
...@@ -124,7 +124,17 @@ GenericMapProjection<Transform, TScalarType, NInputDimensions, NOutputDimensions ...@@ -124,7 +124,17 @@ GenericMapProjection<Transform, TScalarType, NInputDimensions, NOutputDimensions
return false; return false;
} }
//we don't want to have a ossimEquDistCylProjection here:
//see discussion in May 2009 on ossim list;
//a better solution might be available...
if (std::string(kwl.find("type")) == "ossimEquDistCylProjection")
{
std::cout << "WARNING: Not instanciating a ossimEquDistCylProjection"<< std::endl;
return false;
}
m_MapProjection = ossimMapProjectionFactory::instance()->createProjection(kwl); m_MapProjection = ossimMapProjectionFactory::instance()->createProjection(kwl);
this->reinstanciateProjection = false; this->reinstanciateProjection = false;
return true; return true;
} }
......
//******************************************************************* //*******************************************************************
// //
// License: See top level LICENSE.txt file. // License: LGPL
//
// See LICENSE.txt file in the top level directory for more details.
// //
// Author: Frank Warmerdam (warmerda@home.com) // Author: Frank Warmerdam (warmerda@home.com)
// Contributor: David A. Horner // Contributor: David A. Horner
...@@ -8,12 +10,12 @@ ...@@ -8,12 +10,12 @@
// Description: // Description:
// //
// Contains code implementation translation between OGC WKT format, // Contains code implementation translation between OGC WKT format,
// and OSSIM projection keyword lists. Note that services from // and OSSIM projection keyword lists. Note that services from
// GDAL's OGRSpatialReference class are used via the GDAL bridge to // GDAL's OGRSpatialReference class are used via the GDAL bridge to
// accomplish the translation. // accomplish the translation.
// //
//******************************************************************* //*******************************************************************
// $Id: ossimOgcWktTranslator.cpp 14028 2009-02-13 13:12:17Z gpotts $ // $Id: ossimOgcWktTranslator.cpp 14589 2009-05-20 23:51:14Z dburken $
#include <cstdio> #include <cstdio>
#include <gdal.h> #include <gdal.h>
...@@ -34,7 +36,7 @@ ...@@ -34,7 +36,7 @@
#include <ossim/base/ossimUnitConversionTool.h> #include <ossim/base/ossimUnitConversionTool.h>
#include <ossim/base/ossimUnitTypeLut.h> #include <ossim/base/ossimUnitTypeLut.h>
static const double SEMI_MAJOR_AXIS_WGS84 = 6378137.0; static const double SEMI_MAJOR_AXIS_WGS84 = 6378137.0;
static const double SEMI_MINOR_AXIS_WGS84 = 6356752.3142; static const double SEMI_MINOR_AXIS_WGS84 = 6356752.3142;
...@@ -54,15 +56,15 @@ ossimString ossimOgcWktTranslator::fromOssimKwl(const ossimKeywordlist &kwl, ...@@ -54,15 +56,15 @@ ossimString ossimOgcWktTranslator::fromOssimKwl(const ossimKeywordlist &kwl,
{ {
ossimString projType = kwl.find(ossimKeywordNames::TYPE_KW); ossimString projType = kwl.find(ossimKeywordNames::TYPE_KW);
ossimString datumType = kwl.find(ossimKeywordNames::DATUM_KW); ossimString datumType = kwl.find(ossimKeywordNames::DATUM_KW);
ossimString wktString; ossimString wktString;
OGRSpatialReference oSRS; OGRSpatialReference oSRS;
if(projType == "") if(projType == "")
{ {
return wktString; return wktString;
} }
ossimString zone = kwl.find(prefix, ossimKeywordNames::ZONE_KW); ossimString zone = kwl.find(prefix, ossimKeywordNames::ZONE_KW);
ossimString hemisphere = kwl.find(prefix, ossimKeywordNames::HEMISPHERE_KW); ossimString hemisphere = kwl.find(prefix, ossimKeywordNames::HEMISPHERE_KW);
ossimString parallel1 = kwl.find(prefix, ossimKeywordNames::STD_PARALLEL_1_KW); ossimString parallel1 = kwl.find(prefix, ossimKeywordNames::STD_PARALLEL_1_KW);
...@@ -82,13 +84,13 @@ ossimString ossimOgcWktTranslator::fromOssimKwl(const ossimKeywordlist &kwl, ...@@ -82,13 +84,13 @@ ossimString ossimOgcWktTranslator::fromOssimKwl(const ossimKeywordlist &kwl,
ossimUnitType units = ossimUnitType units =
static_cast<ossimUnitType>(ossimUnitTypeLut::instance()-> static_cast<ossimUnitType>(ossimUnitTypeLut::instance()->
getEntryNumber(lookup)); getEntryNumber(lookup));
lookup = kwl.find(prefix, ossimKeywordNames::FALSE_EASTING_NORTHING_KW); lookup = kwl.find(prefix, ossimKeywordNames::FALSE_EASTING_NORTHING_KW);
if (lookup) if (lookup)
{ {
ossimDpt eastingNorthing; ossimDpt eastingNorthing;
eastingNorthing.toPoint(std::string(lookup)); eastingNorthing.toPoint(std::string(lookup));
switch (units) switch (units)
{ {
case OSSIM_METERS: case OSSIM_METERS:
...@@ -113,14 +115,14 @@ ossimString ossimOgcWktTranslator::fromOssimKwl(const ossimKeywordlist &kwl, ...@@ -113,14 +115,14 @@ ossimString ossimOgcWktTranslator::fromOssimKwl(const ossimKeywordlist &kwl,
<< "ossimOgcWktTranslator::fromOssimKwl WARNING!" << "ossimOgcWktTranslator::fromOssimKwl WARNING!"
<< "Unhandled unit type for " << "Unhandled unit type for "
<< ossimKeywordNames::FALSE_EASTING_NORTHING_UNITS_KW << ossimKeywordNames::FALSE_EASTING_NORTHING_UNITS_KW
<< ": " << ": "
<< ( ossimUnitTypeLut::instance()-> << ( ossimUnitTypeLut::instance()->
getEntryString(units).c_str() ) getEntryString(units).c_str() )
<< endl; << endl;
break; break;
} }
} // End of switch (units) } // End of switch (units)
} // End of if (FALSE_EASTING_NORTHING_KW) } // End of if (FALSE_EASTING_NORTHING_KW)
} // End of if (FALSE_EASTING_NORTHING_UNITS_KW) } // End of if (FALSE_EASTING_NORTHING_UNITS_KW)
...@@ -132,7 +134,7 @@ ossimString ossimOgcWktTranslator::fromOssimKwl(const ossimKeywordlist &kwl, ...@@ -132,7 +134,7 @@ ossimString ossimOgcWktTranslator::fromOssimKwl(const ossimKeywordlist &kwl,
{ {
falseEastingNorthing.x = fabs(ossimString(lookup).toFloat64()); falseEastingNorthing.x = fabs(ossimString(lookup).toFloat64());
} }
lookup = kwl.find(prefix, ossimKeywordNames::FALSE_NORTHING_KW); lookup = kwl.find(prefix, ossimKeywordNames::FALSE_NORTHING_KW);
if(lookup) if(lookup)
{ {
...@@ -141,11 +143,11 @@ ossimString ossimOgcWktTranslator::fromOssimKwl(const ossimKeywordlist &kwl, ...@@ -141,11 +143,11 @@ ossimString ossimOgcWktTranslator::fromOssimKwl(const ossimKeywordlist &kwl,
} }
oSRS.SetLinearUnits("Meter", 1.0); oSRS.SetLinearUnits("Meter", 1.0);
if(projType == "ossimUtmProjection") if(projType == "ossimUtmProjection")
{ {
hemisphere = hemisphere.trim().upcase(); hemisphere = hemisphere.trim().upcase();
if(hemisphere != "") if(hemisphere != "")
{ {
oSRS.SetUTM(zone.toLong(), hemisphere != "S"); oSRS.SetUTM(zone.toLong(), hemisphere != "S");
...@@ -158,26 +160,26 @@ ossimString ossimOgcWktTranslator::fromOssimKwl(const ossimKeywordlist &kwl, ...@@ -158,26 +160,26 @@ ossimString ossimOgcWktTranslator::fromOssimKwl(const ossimKeywordlist &kwl,
else if(projType == "ossimLlxyProjection") else if(projType == "ossimLlxyProjection")
{ {
OGRSpatialReference oGeogCS; OGRSpatialReference oGeogCS;
oGeogCS.SetEquirectangular(0.0, oGeogCS.SetEquirectangular(0.0,
0.0, 0.0,
0.0, 0.0,
0.0); 0.0);
oGeogCS.SetAngularUnits(SRS_UA_DEGREE, atof(SRS_UA_DEGREE_CONV)); oGeogCS.SetAngularUnits(SRS_UA_DEGREE, atof(SRS_UA_DEGREE_CONV));
oSRS.CopyGeogCSFrom( &oGeogCS ); oSRS.CopyGeogCSFrom( &oGeogCS );
} }
else if(projType == "ossimEquDistCylProjection") else if(projType == "ossimEquDistCylProjection")
{ {
OGRSpatialReference oGeogCS; OGRSpatialReference oGeogCS;
oGeogCS.SetEquirectangular(originLat.toDouble(), oGeogCS.SetEquirectangular(originLat.toDouble(),
centralMeridian.toDouble(), centralMeridian.toDouble(),
falseEastingNorthing.x, falseEastingNorthing.x,
falseEastingNorthing.y); falseEastingNorthing.y);
oGeogCS.SetAngularUnits(SRS_UA_DEGREE, atof(SRS_UA_DEGREE_CONV)); oGeogCS.SetAngularUnits(SRS_UA_DEGREE, atof(SRS_UA_DEGREE_CONV));
oSRS.CopyGeogCSFrom( &oGeogCS ); oSRS.CopyGeogCSFrom( &oGeogCS );
} }
else if(projType == "ossimSinusoidalProjection") else if(projType == "ossimSinusoidalProjection")
{ {
...@@ -315,7 +317,7 @@ ossimString ossimOgcWktTranslator::fromOssimKwl(const ossimKeywordlist &kwl, ...@@ -315,7 +317,7 @@ ossimString ossimOgcWktTranslator::fromOssimKwl(const ossimKeywordlist &kwl,
falseEastingNorthing.x, falseEastingNorthing.x,
falseEastingNorthing.y); falseEastingNorthing.y);
} }
else else
{ {
cerr << "ossimOgcWktTranslator::fromOssimKwl:\n" cerr << "ossimOgcWktTranslator::fromOssimKwl:\n"
<< "Projection translation for " << "Projection translation for "
...@@ -323,24 +325,24 @@ ossimString ossimOgcWktTranslator::fromOssimKwl(const ossimKeywordlist &kwl, ...@@ -323,24 +325,24 @@ ossimString ossimOgcWktTranslator::fromOssimKwl(const ossimKeywordlist &kwl,
<< " not supported " << " not supported "
<< endl; << endl;
} }
datumType = datumType.upcase(); datumType = datumType.upcase();
if(datumType == "WGE") if(datumType == "WGE")
{ {
oSRS.SetWellKnownGeogCS("WGS84"); oSRS.SetWellKnownGeogCS("WGS84");
} }
else if(datumType == "WGD") else if(datumType == "WGD")
{ {
oSRS.SetWellKnownGeogCS("WGS72"); oSRS.SetWellKnownGeogCS("WGS72");
} }
else if(datumType == "NAS-C") //1927 else if(datumType == "NAS-C") //1927
{ {
oSRS.SetWellKnownGeogCS("NAD27"); oSRS.SetWellKnownGeogCS("NAD27");
} }
else if(datumType == "NAS") //1927 else if(datumType == "NAS") //1927
{ {
oSRS.SetWellKnownGeogCS("NAD27"); oSRS.SetWellKnownGeogCS("NAD27");
} }
else if(datumType == "NAR-C") // 1983 else if(datumType == "NAR-C") // 1983
{ {
...@@ -361,18 +363,18 @@ ossimString ossimOgcWktTranslator::fromOssimKwl(const ossimKeywordlist &kwl, ...@@ -361,18 +363,18 @@ ossimString ossimOgcWktTranslator::fromOssimKwl(const ossimKeywordlist &kwl,
<<" not supported" <<" not supported"
<< endl; << endl;
} }
char* exportString = NULL; char* exportString = NULL;
oSRS.exportToWkt(&exportString); oSRS.exportToWkt(&exportString);
if(exportString) if(exportString)
{ {
wktString = exportString; wktString = exportString;
OGRFree(exportString); OGRFree(exportString);
} }
return wktString; return wktString;
} }
bool ossimOgcWktTranslator::toOssimKwl( const ossimString& wktString, bool ossimOgcWktTranslator::toOssimKwl( const ossimString& wktString,
...@@ -381,26 +383,20 @@ bool ossimOgcWktTranslator::toOssimKwl( const ossimString& wktString, ...@@ -381,26 +383,20 @@ bool ossimOgcWktTranslator::toOssimKwl( const ossimString& wktString,
{ {
static const char MODULE[] = "ossimOgcWktTranslator::toOssimKwl"; static const char MODULE[] = "ossimOgcWktTranslator::toOssimKwl";
const char* wkt = wktString.c_str(); const char* wkt = wktString.c_str();
OGRSpatialReferenceH hSRS = NULL; OGRSpatialReferenceH hSRS = NULL;
ossimDpt falseEastingNorthing; ossimDpt falseEastingNorthing;
// Translate the WKT into an OGRSpatialReference. // Translate the WKT into an OGRSpatialReference.
hSRS = OSRNewSpatialReference(NULL); hSRS = OSRNewSpatialReference(NULL);
if( OSRImportFromWkt( hSRS, (char **) &wkt ) != OGRERR_NONE ) if( OSRImportFromWkt( hSRS, (char **) &wkt ) != OGRERR_NONE )
{ {
OSRDestroySpatialReference( hSRS ); OSRDestroySpatialReference( hSRS );
return false; return false;
} }
if (static_cast<OGRSpatialReference *>(hSRS)->IsGeographic())
{
OSRDestroySpatialReference( hSRS );
return false;
}
// Determine if State Plane Coordinate System // Determine if State Plane Coordinate System
ossimString ossimProj = ""; ossimString ossimProj = "";
const ossimStatePlaneProjectionInfo* spi = NULL; const ossimStatePlaneProjectionInfo* spi = NULL;
...@@ -410,33 +406,44 @@ bool ossimOgcWktTranslator::toOssimKwl( const ossimString& wktString, ...@@ -410,33 +406,44 @@ bool ossimOgcWktTranslator::toOssimKwl( const ossimString& wktString,
ossimStatePlaneProjectionFactory* spf = ossimStatePlaneProjectionFactory* spf =
ossimStatePlaneProjectionFactory::instance(); ossimStatePlaneProjectionFactory::instance();
spi = spf->getInfo(ossimString::toInt(epsg_code)); spi = spf->getInfo(ossimString::toInt(epsg_code));
if(spi) if(spi)
{ {
ossimProj = "ossimStatePlaneProjection"; ossimProj = "ossimStatePlaneProjection";
} }
} }
//---
// Extract Units // Extract Units
// // ESH 11/2008: Check for geographic system when setting default units.
// If geographic, use degrees.
//---
const char* units = OSRGetAttrValue( hSRS, "UNIT", 0 ); const char* units = OSRGetAttrValue( hSRS, "UNIT", 0 );
ossimString ossim_units = "meters"; ossimString ossim_units;
bool bGeog = OSRIsGeographic(hSRS);
if(units) if ( bGeog == false )
{ {
if(ossimString(units) == ossimString("U.S. Foot")) ossim_units = "meters";
ossim_units = "us_survey_feet"; if ( units != NULL )
else if(ossimString(units) == ossimString("US survey foot")) {
ossim_units = "us_survey_feet"; if(ossimString(units) == ossimString("U.S. Foot"))
else if(ossimString(units) == ossimString("degree")) ossim_units = "us_survey_feet";
ossim_units = "degrees"; else if(ossimString(units) == ossimString("US survey foot"))
else if(ossimString(units) == ossimString("Meter")) ossim_units = "us_survey_feet";
ossim_units = "meters"; else if(ossimString(units) == ossimString("degree"))
else if(ossimString(units) == ossimString("metre")) ossim_units = "degrees";
ossim_units = "meters"; else if(ossimString(units) == ossimString("Meter"))
ossim_units = "meters";
else if(ossimString(units) == ossimString("metre"))
ossim_units = "meters";
}
} }
kwl.add(prefix, ossimKeywordNames::UNITS_KW, ossim_units, true); else
{
ossim_units = "degrees";
}
bool bModified = false;
if(ossimProj == "") // Not State Plane Projection if(ossimProj == "") // Not State Plane Projection
{ {
// Determine which other Projection System is represented. // Determine which other Projection System is represented.
...@@ -449,10 +456,9 @@ bool ossimOgcWktTranslator::toOssimKwl( const ossimString& wktString, ...@@ -449,10 +456,9 @@ bool ossimOgcWktTranslator::toOssimKwl( const ossimString& wktString,
{ {
ossimString localCs = OSRGetAttrValue( hSRS, "LOCAL_CS", 0 ); ossimString localCs = OSRGetAttrValue( hSRS, "LOCAL_CS", 0 );
localCs = localCs.upcase(); localCs = localCs.upcase();
// std::cout << "localCs ========== " << localCs << std::endl;
if(localCs == "GREATBRITAIN_GRID") if(localCs == "GREATBRITAIN_GRID")
{ {
ossimProj = "ossimBngProjection"; ossimProj = "ossimBngProjection";
} }
else if (ossim_units.contains("degree")) else if (ossim_units.contains("degree"))
{ {
...@@ -460,18 +466,32 @@ bool ossimOgcWktTranslator::toOssimKwl( const ossimString& wktString, ...@@ -460,18 +466,32 @@ bool ossimOgcWktTranslator::toOssimKwl( const ossimString& wktString,
ossimProj = "ossimEquDistCylProjection"; ossimProj = "ossimEquDistCylProjection";
} }
} }
if ( ossimProj != "" )
{
bModified = true;
}
}
// ESH 11/2008: Ticket #479, if we've got a geographic coordsys
// make sure the units are set to degrees.
if( bModified == true && ossimProj == "ossimEquDistCylProjection" )
{
ossim_units = "degrees";
} }
// ESH 11/2008: Ticket #479, don't set units until we've checked
// whether or not the projection was updated.
kwl.add(prefix, ossimKeywordNames::UNITS_KW, ossim_units, true);
if (traceDebug()) if (traceDebug())
{ {
ossimNotify(ossimNotifyLevel_DEBUG) ossimNotify(ossimNotifyLevel_DEBUG)
<< MODULE << "DEBUG:" << MODULE << "DEBUG:"
<< "\nossimProj = " << ossimProj << endl; << "\nossimProj = " << ossimProj << endl;
} }
kwl.add(prefix,
ossimKeywordNames::TYPE_KW, kwl.add(prefix, ossimKeywordNames::TYPE_KW, ossimProj.c_str(), true);
ossimProj.c_str(),
true);
falseEastingNorthing.x = OSRGetProjParm(hSRS, SRS_PP_FALSE_EASTING, 0.0, NULL); falseEastingNorthing.x = OSRGetProjParm(hSRS, SRS_PP_FALSE_EASTING, 0.0, NULL);
falseEastingNorthing.y = OSRGetProjParm(hSRS, SRS_PP_FALSE_NORTHING, 0.0, NULL); falseEastingNorthing.y = OSRGetProjParm(hSRS, SRS_PP_FALSE_NORTHING, 0.0, NULL);
...@@ -492,30 +512,28 @@ bool ossimOgcWktTranslator::toOssimKwl( const ossimString& wktString, ...@@ -492,30 +512,28 @@ bool ossimOgcWktTranslator::toOssimKwl( const ossimString& wktString,
ossimKeywordNames::STD_PARALLEL_1_KW, ossimKeywordNames::STD_PARALLEL_1_KW,
OSRGetProjParm(hSRS, SRS_PP_STANDARD_PARALLEL_1, 0.0, NULL), OSRGetProjParm(hSRS, SRS_PP_STANDARD_PARALLEL_1, 0.0, NULL),
true); true);
kwl.add(prefix, kwl.add(prefix,
ossimKeywordNames::ORIGIN_LATITUDE_KW, ossimKeywordNames::ORIGIN_LATITUDE_KW,
OSRGetProjParm(hSRS, SRS_PP_STANDARD_PARALLEL_1, 0.0, NULL), OSRGetProjParm(hSRS, SRS_PP_STANDARD_PARALLEL_1, 0.0, NULL),
true); true);
kwl.add(prefix, ossimUnitType units =
ossimKeywordNames::FALSE_EASTING_NORTHING_KW, static_cast<ossimUnitType>(ossimUnitTypeLut::instance()->
falseEastingNorthing.toString(), getEntryNumber(ossim_units.c_str()));
true); if ( units == OSSIM_METERS ||
kwl.add(prefix, units == OSSIM_FEET ||
ossimKeywordNames::FALSE_EASTING_NORTHING_UNITS_KW, units == OSSIM_US_SURVEY_FEET )
ossim_units, {
true); kwl.add(prefix,
ossimKeywordNames::FALSE_EASTING_NORTHING_KW,
// kwl.add(prefix, falseEastingNorthing.toString(),
// ossimKeywordNames::FALSE_EASTING_KW, true);
// OSRGetProjParm(hSRS, SRS_PP_FALSE_EASTING, 0.0, NULL), kwl.add(prefix,
// true); ossimKeywordNames::FALSE_EASTING_NORTHING_UNITS_KW,
ossim_units,
// kwl.add(prefix, true);
// ossimKeywordNames::FALSE_NORTHING_KW, }
// OSRGetProjParm(hSRS, SRS_PP_FALSE_NORTHING, 0.0, NULL),
// true);
} }
else if(ossimProj == "ossimEquDistCylProjection") else if(ossimProj == "ossimEquDistCylProjection")
{ {
...@@ -523,14 +541,24 @@ bool ossimOgcWktTranslator::toOssimKwl( const ossimString& wktString, ...@@ -523,14 +541,24 @@ bool ossimOgcWktTranslator::toOssimKwl( const ossimString& wktString,
ossimKeywordNames::TYPE_KW, ossimKeywordNames::TYPE_KW,
"ossimEquDistCylProjection", "ossimEquDistCylProjection",
true); true);
kwl.add(prefix,
ossimKeywordNames::FALSE_EASTING_NORTHING_KW, ossimUnitType units =
falseEastingNorthing.toString(), static_cast<ossimUnitType>(ossimUnitTypeLut::instance()->
true); getEntryNumber(ossim_units.c_str()));
kwl.add(prefix, if ( units == OSSIM_METERS ||
ossimKeywordNames::FALSE_EASTING_NORTHING_UNITS_KW, units == OSSIM_FEET ||
ossim_units, units == OSSIM_US_SURVEY_FEET )
true); {
kwl.add(prefix,
ossimKeywordNames::FALSE_EASTING_NORTHING_KW,
falseEastingNorthing.toString(),
true);
kwl.add(prefix,
ossimKeywordNames::FALSE_EASTING_NORTHING_UNITS_KW,
ossim_units,
true);
}
kwl.add(prefix, kwl.add(prefix,
ossimKeywordNames::ORIGIN_LATITUDE_KW, ossimKeywordNames::ORIGIN_LATITUDE_KW,
OSRGetProjParm(hSRS, SRS_PP_LATITUDE_OF_ORIGIN, 0.0, NULL), OSRGetProjParm(hSRS, SRS_PP_LATITUDE_OF_ORIGIN, 0.0, NULL),
...@@ -618,14 +646,13 @@ bool ossimOgcWktTranslator::toOssimKwl( const ossimString& wktString, ...@@ -618,14 +646,13 @@ bool ossimOgcWktTranslator::toOssimKwl( const ossimString& wktString,
{ {
int bNorth; int bNorth;
int nZone = OSRGetUTMZone( hSRS, &bNorth ); int nZone = OSRGetUTMZone( hSRS, &bNorth );
OGRErr err = OGRERR_NONE;
if( nZone != 0 ) if( nZone != 0 )
{ {
kwl.add(prefix, kwl.add(prefix,
ossimKeywordNames::TYPE_KW, ossimKeywordNames::TYPE_KW,
"ossimUtmProjection", "ossimUtmProjection",
true); true);
kwl.add(prefix, kwl.add(prefix,
ossimKeywordNames::ZONE_KW, ossimKeywordNames::ZONE_KW,
nZone, nZone,
...@@ -638,7 +665,7 @@ bool ossimOgcWktTranslator::toOssimKwl( const ossimString& wktString, ...@@ -638,7 +665,7 @@ bool ossimOgcWktTranslator::toOssimKwl( const ossimString& wktString,
{ {
kwl.add(prefix, ossimKeywordNames::HEMISPHERE_KW, "S", true); kwl.add(prefix, ossimKeywordNames::HEMISPHERE_KW, "S", true);
} }
} }
else else
{ {
kwl.add(prefix, kwl.add(prefix,
...@@ -649,7 +676,7 @@ bool ossimOgcWktTranslator::toOssimKwl( const ossimString& wktString, ...@@ -649,7 +676,7 @@ bool ossimOgcWktTranslator::toOssimKwl( const ossimString& wktString,
ossimKeywordNames::SCALE_FACTOR_KW, ossimKeywordNames::SCALE_FACTOR_KW,
OSRGetProjParm(hSRS, SRS_PP_SCALE_FACTOR, 1.0, NULL), OSRGetProjParm(hSRS, SRS_PP_SCALE_FACTOR, 1.0, NULL),
true); true);
kwl.add(prefix, kwl.add(prefix,
ossimKeywordNames::ORIGIN_LATITUDE_KW, ossimKeywordNames::ORIGIN_LATITUDE_KW,
OSRGetProjParm(hSRS, SRS_PP_LATITUDE_OF_ORIGIN, 0.0, NULL), OSRGetProjParm(hSRS, SRS_PP_LATITUDE_OF_ORIGIN, 0.0, NULL),
...@@ -675,7 +702,7 @@ bool ossimOgcWktTranslator::toOssimKwl( const ossimString& wktString, ...@@ -675,7 +702,7 @@ bool ossimOgcWktTranslator::toOssimKwl( const ossimString& wktString,
ossimNotify(ossimNotifyLevel_DEBUG) ossimNotify(ossimNotifyLevel_DEBUG)
<< "ossimOgcWktTranslator::toOssimKwl DEBUG:\n" << "ossimOgcWktTranslator::toOssimKwl DEBUG:\n"
<< "Projection conversion to OSSIM not supported !!!!!!!!!\n" << "Projection conversion to OSSIM not supported !!!!!!!!!\n"
<< "Please send the following string to the development staff\n" << "Please send the following string to the development staff\n"
<< "to be added to the transaltion to OSSIM\n" << "to be added to the transaltion to OSSIM\n"
<< wkt << endl; << wkt << endl;
} }
...@@ -685,7 +712,7 @@ bool ossimOgcWktTranslator::toOssimKwl( const ossimString& wktString, ...@@ -685,7 +712,7 @@ bool ossimOgcWktTranslator::toOssimKwl( const ossimString& wktString,
// //
const char *datum = OSRGetAttrValue( hSRS, "DATUM", 0 ); const char *datum = OSRGetAttrValue( hSRS, "DATUM", 0 );
ossimString oDatum = "WGE"; ossimString oDatum = "WGE";
if( datum ) if( datum )
{ {
oDatum = wktToOssimDatum(datum); oDatum = wktToOssimDatum(datum);
...@@ -694,13 +721,13 @@ bool ossimOgcWktTranslator::toOssimKwl( const ossimString& wktString, ...@@ -694,13 +721,13 @@ bool ossimOgcWktTranslator::toOssimKwl( const ossimString& wktString,
oDatum = "WGE"; oDatum = "WGE";
} }
} }
kwl.add(prefix, ossimKeywordNames::DATUM_KW, oDatum, true); kwl.add(prefix, ossimKeywordNames::DATUM_KW, oDatum, true);
// std::cout << "KWL ======= " << kwl << std::endl; // std::cout << "KWL ======= " << kwl << std::endl;
OSRDestroySpatialReference( hSRS ); OSRDestroySpatialReference( hSRS );
return true; return true;
} }
...@@ -709,14 +736,14 @@ void ossimOgcWktTranslator::initializeDatumTable() ...@@ -709,14 +736,14 @@ void ossimOgcWktTranslator::initializeDatumTable()
{ {
// theWktToOssimDatumTranslation.insert(make_pair(ossimString("North_American_Datum_1927"), // theWktToOssimDatumTranslation.insert(make_pair(ossimString("North_American_Datum_1927"),
// ossimString("NAS-C"))); // ossimString("NAS-C")));
// theWktToOssimDatumTranslation.insert(make_pair(ossimString("North_American_Datum_1983"), // theWktToOssimDatumTranslation.insert(make_pair(ossimString("North_American_Datum_1983"),
// ossimString("NAR-C"))); // ossimString("NAR-C")));
// theWktToOssimDatumTranslation.insert(make_pair(ossimString("WGS_1984"), // theWktToOssimDatumTranslation.insert(make_pair(ossimString("WGS_1984"),
// ossimString("WGE"))); // ossimString("WGE")));
// theWktToOssimDatumTranslation.insert(make_pair(ossimString("OSGB_1936"), // theWktToOssimDatumTranslation.insert(make_pair(ossimString("OSGB_1936"),
// ossimString("OSGB_1936"))); // ossimString("OSGB_1936")));
theOssimToWktDatumTranslation.insert(make_pair(ossimString("NAS-C"), theOssimToWktDatumTranslation.insert(make_pair(ossimString("NAS-C"),
ossimString("North_American_Datum_1927"))); ossimString("North_American_Datum_1927")));
theOssimToWktDatumTranslation.insert(make_pair(ossimString("NAR-C"), theOssimToWktDatumTranslation.insert(make_pair(ossimString("NAR-C"),
...@@ -728,7 +755,7 @@ void ossimOgcWktTranslator::initializeDatumTable() ...@@ -728,7 +755,7 @@ void ossimOgcWktTranslator::initializeDatumTable()
theOssimToWktDatumTranslation.insert(make_pair(ossimString("WGE"), theOssimToWktDatumTranslation.insert(make_pair(ossimString("WGE"),
ossimString("WGS_1984"))); ossimString("WGS_1984")));
theWktToOssimDatumTranslation.insert(make_pair(ossimString("OSGB_1936"), theWktToOssimDatumTranslation.insert(make_pair(ossimString("OSGB_1936"),
ossimString("OGB-B"))); ossimString("OGB-B")));
} }
void ossimOgcWktTranslator::initializeProjectionTable() void ossimOgcWktTranslator::initializeProjectionTable()
...@@ -757,7 +784,7 @@ void ossimOgcWktTranslator::initializeProjectionTable() ...@@ -757,7 +784,7 @@ void ossimOgcWktTranslator::initializeProjectionTable()
ossimString(SRS_PT_SINUSOIDAL))); ossimString(SRS_PT_SINUSOIDAL)));
theOssimToWktProjectionTranslation.insert(make_pair(ossimString("ossimMercatorProjection"), theOssimToWktProjectionTranslation.insert(make_pair(ossimString("ossimMercatorProjection"),
ossimString(SRS_PT_MERCATOR_1SP))); ossimString(SRS_PT_MERCATOR_1SP)));
} }
ossimString ossimOgcWktTranslator::wktToOssimDatum(const ossimString& datum)const ossimString ossimOgcWktTranslator::wktToOssimDatum(const ossimString& datum)const
...@@ -790,7 +817,7 @@ ossimString ossimOgcWktTranslator::wktToOssimDatum(const ossimString& datum)cons ...@@ -790,7 +817,7 @@ ossimString ossimOgcWktTranslator::wktToOssimDatum(const ossimString& datum)cons
{ {
return "OGB-D"; return "OGB-D";
} }
return ""; return "";
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment