bool SpatialReference::isGeographic() const { OGRSpatialReferenceH current = OSRNewSpatialReference(getWKT(eCompoundOK, false).c_str()); bool output = OSRIsGeographic(current); OSRDestroySpatialReference(current); return output; }
void QgsGrassNewMapset::setGrassProjection() { QgsDebugMsg( "entered." ); setError( mProjErrorLabel, "" ); QString proj4 = mProjectionSelector->selectedProj4String(); // Not defined if ( mNoProjRadioButton->isChecked() ) { mCellHead.proj = PROJECTION_XY; mCellHead.zone = 0; mProjInfo = 0; mProjUnits = 0; button( QWizard::NextButton )->setEnabled( true ); return; } // Define projection if ( !proj4.isEmpty() ) { QgsDebugMsg( QString( "proj4 = %1" ).arg( proj4.toLocal8Bit().constData() ) ); OGRSpatialReferenceH hCRS = NULL; hCRS = OSRNewSpatialReference( NULL ); int errcode; const char *oldlocale = setlocale( LC_NUMERIC, NULL ); setlocale( LC_NUMERIC, "C" ); errcode = OSRImportFromProj4( hCRS, proj4.toUtf8() ); setlocale( LC_NUMERIC, oldlocale ); if ( errcode != OGRERR_NONE ) { QgsDebugMsg( QString( "OGR can't parse PROJ.4-style parameter string:\n%1\nOGR Error code was %2" ).arg( proj4 ).arg( errcode ) ); mCellHead.proj = PROJECTION_XY; mCellHead.zone = 0; mProjInfo = 0; mProjUnits = 0; } else { char *wkt = NULL; QgsDebugMsg( QString( "OSRIsGeographic = %1" ).arg( OSRIsGeographic( hCRS ) ) ); QgsDebugMsg( QString( "OSRIsProjected = %1" ).arg( OSRIsProjected( hCRS ) ) ); if (( errcode = OSRExportToWkt( hCRS, &wkt ) ) != OGRERR_NONE ) { QgsDebugMsg( QString( "OGR can't get Wkt-style parameter string\nOGR Error code was %1" ).arg( errcode ) ); } else { QgsDebugMsg( QString( "wkt = %1" ).arg( wkt ) ); } // Note: GPJ_osr_to_grass() defaults in PROJECTION_XY if projection // cannot be set // There was a bug in GRASS, it is present in 6.0.x line int ret = GPJ_wkt_to_grass( &mCellHead, &mProjInfo, &mProjUnits, wkt, 0 ); // Note: It seems that GPJ_osr_to_grass()returns always 1, // -> test if mProjInfo was set Q_UNUSED( ret ); QgsDebugMsg( QString( "ret = %1" ).arg( ret ) ); QgsDebugMsg( QString( "mProjInfo = %1" ).arg( QString::number(( qulonglong )mProjInfo, 16 ).toLocal8Bit().constData() ) ); OGRFree( wkt ); } if ( !mProjInfo || !mProjUnits ) { setError( mProjErrorLabel, tr( "Selected projection is not supported by GRASS!" ) ); } } else // Nothing selected { mCellHead.proj = PROJECTION_XY; mCellHead.zone = 0; mProjInfo = 0; mProjUnits = 0; } button( QWizard::NextButton )->setEnabled( mProjInfo && mProjUnits ); }
int GPJ_osr_to_grass(struct Cell_head *cellhd, struct Key_Value **projinfo, struct Key_Value **projunits, OGRSpatialReferenceH hSRS, int datumtrans) { struct Key_Value *temp_projinfo; char *pszProj4 = NULL, *pszRemaining; char *pszProj = NULL; char *datum = NULL; struct gpj_datum dstruct; if (hSRS == NULL) goto default_to_xy; /* Set finder function for locating OGR csv co-ordinate system tables */ SetCSVFilenameHook(GPJ_set_csv_loc); /* Hopefully this doesn't do any harm if it wasn't in ESRI format * to start with... */ OSRMorphFromESRI(hSRS); /* -------------------------------------------------------------------- */ /* Set cellhd for well known coordinate systems. */ /* -------------------------------------------------------------------- */ if (!OSRIsGeographic(hSRS) && !OSRIsProjected(hSRS)) goto default_to_xy; if (cellhd) { int bNorth; if (OSRIsGeographic(hSRS)) { cellhd->proj = PROJECTION_LL; cellhd->zone = 0; } else if (OSRGetUTMZone(hSRS, &bNorth) != 0) { cellhd->proj = PROJECTION_UTM; cellhd->zone = OSRGetUTMZone(hSRS, &bNorth); if (!bNorth) cellhd->zone *= -1; } else { cellhd->proj = PROJECTION_OTHER; cellhd->zone = 0; } } /* -------------------------------------------------------------------- */ /* Get the coordinate system definition in PROJ.4 format. */ /* -------------------------------------------------------------------- */ if (OSRExportToProj4(hSRS, &pszProj4) != OGRERR_NONE) goto default_to_xy; /* -------------------------------------------------------------------- */ /* Parse the PROJ.4 string into key/value pairs. Do a bit of */ /* extra work to "GRASSify" the result. */ /* -------------------------------------------------------------------- */ temp_projinfo = G_create_key_value(); /* Create "local" copy of proj4 string so we can modify and free it * using GRASS functions */ pszRemaining = G_store(pszProj4); CPLFree(pszProj4); pszProj4 = pszRemaining; while ((pszRemaining = strstr(pszRemaining, "+")) != NULL) { char *pszToken, *pszValue; pszRemaining++; /* Advance pszRemaining to end of this token[=value] pair */ pszToken = pszRemaining; while (*pszRemaining != ' ' && *pszRemaining != '\0') pszRemaining++; if (*pszRemaining == ' ') { *pszRemaining = '\0'; pszRemaining++; } /* parse token, and value */ if (strstr(pszToken, "=") != NULL) { pszValue = strstr(pszToken, "="); *pszValue = '\0'; pszValue++; } else pszValue = "defined"; if (G_strcasecmp(pszToken, "proj") == 0) { /* The ll projection is known as longlat in PROJ.4 */ if (G_strcasecmp(pszValue, "longlat") == 0) pszValue = "ll"; pszProj = pszValue; continue; } /* Ellipsoid and datum handled separately below */ if (G_strcasecmp(pszToken, "ellps") == 0 || G_strcasecmp(pszToken, "a") == 0 || G_strcasecmp(pszToken, "b") == 0 || G_strcasecmp(pszToken, "es") == 0 || G_strcasecmp(pszToken, "rf") == 0 || G_strcasecmp(pszToken, "datum") == 0) continue; /* We will handle units separately */ if (G_strcasecmp(pszToken, "to_meter") == 0 || G_strcasecmp(pszToken, "units") == 0) continue; G_set_key_value(pszToken, pszValue, temp_projinfo); } *projinfo = G_create_key_value(); /* -------------------------------------------------------------------- */ /* Derive the user name for the projection. */ /* -------------------------------------------------------------------- */ if (pszProj) { char path[4095]; char name[80]; sprintf(path, "%s/etc/projections", G_gisbase()); if (G_lookup_key_value_from_file(path, pszProj, name, sizeof(name)) > 0) G_set_key_value("name", name, *projinfo); else G_set_key_value("name", pszProj, *projinfo); G_set_key_value("proj", pszProj, *projinfo); } else G_warning(_("No projection name! Projection parameters likely to be meaningless.")); /* -------------------------------------------------------------------- */ /* Find the GRASS datum name and choose parameters either */ /* interactively or not. */ /* -------------------------------------------------------------------- */ { const char *pszDatumNameConst = OSRGetAttrValue(hSRS, "DATUM", 0); struct datum_list *list, *listhead; char *dum1, *dum2, *pszDatumName; int paramspresent = GPJ__get_datum_params(temp_projinfo, &dum1, &dum2); if (pszDatumNameConst) { /* Need to make a new copy of the string so we don't mess * around with the memory inside the OGRSpatialReferenceH? */ pszDatumName = G_store(pszDatumNameConst); DatumNameMassage(&pszDatumName); list = listhead = read_datum_table(); while (list != NULL) { if (G_strcasecmp(pszDatumName, list->longname) == 0) { datum = G_store(list->name); break; } list = list->next; } free_datum_list(listhead); if (datum == NULL) { if (paramspresent < 2) /* Only give warning if no parameters present */ G_warning(_("Datum <%s> not recognised by GRASS and no parameters found"), pszDatumName); } else { G_set_key_value("datum", datum, *projinfo); if (paramspresent < 2) { /* If no datum parameters were imported from the OSR * object then we should use the set specified by datumtrans */ char *params, *chosenparams = NULL; int paramsets; paramsets = GPJ_get_default_datum_params_by_name(datum, ¶ms); if (paramsets < 0) G_warning(_("Datum <%s> apparently recognised by GRASS but no parameters found. " "You may want to look into this."), datum); else if (datumtrans > paramsets) { G_warning(_("Invalid transformation number %d; valid range is 1 to %d. " "Leaving datum transform parameters unspecified."), datumtrans, paramsets); datumtrans = 0; } if (paramsets > 0) { struct gpj_datum_transform_list *list, *old; list = GPJ_get_datum_transform_by_name(datum); if (list != NULL) { do { if (list->count == datumtrans) chosenparams = G_store(list->params); old = list; list = list->next; GPJ_free_datum_transform(old); } while (list != NULL); } } if (chosenparams != NULL) { char *paramkey, *paramvalue; paramkey = strtok(chosenparams, "="); paramvalue = chosenparams + strlen(paramkey) + 1; G_set_key_value(paramkey, paramvalue, *projinfo); G_free(chosenparams); } if (paramsets > 0) G_free(params); } } G_free(pszDatumName); } } /* -------------------------------------------------------------------- */ /* Determine an appropriate GRASS ellipsoid name if possible, or */ /* else just put a and es values into PROJ_INFO */ /* -------------------------------------------------------------------- */ if ((datum != NULL) && (GPJ_get_datum_by_name(datum, &dstruct) > 0)) { /* Use ellps name associated with datum */ G_set_key_value("ellps", dstruct.ellps, *projinfo); GPJ_free_datum(&dstruct); G_free(datum); } else { /* If we can't determine the ellipsoid from the datum, derive it * directly from "SPHEROID" parameters in WKT */ const char *pszSemiMajor = OSRGetAttrValue(hSRS, "SPHEROID", 1); const char *pszInvFlat = OSRGetAttrValue(hSRS, "SPHEROID", 2); if (pszSemiMajor != NULL && pszInvFlat != NULL) { char *ellps = NULL; struct ellps_list *list, *listhead; double a = atof(pszSemiMajor), invflat = atof(pszInvFlat), flat; double es; /* Allow for incorrect WKT describing a sphere where InvFlat * is given as 0 rather than inf */ if (invflat > 0) flat = 1 / invflat; else flat = 0; es = flat * (2.0 - flat); list = listhead = read_ellipsoid_table(0); while (list != NULL) { /* Try and match a and es against GRASS defined ellipsoids; * accept first one that matches. These numbers were found * by trial and error and could be fine-tuned, or possibly * a direct comparison of IEEE floating point values used. */ if ((a == list->a || fabs(a - list->a) < 0.1 || fabs(1 - a / list->a) < 0.0000001) && ((es == 0 && list->es == 0) || /* Special case for sphere */ (invflat == list->rf || fabs(invflat - list->rf) < 0.0000001))) { ellps = G_store(list->name); break; } list = list->next; } if (listhead != NULL) free_ellps_list(listhead); if (ellps == NULL) { /* If we weren't able to find a matching ellps name, set * a and es values directly from WKT-derived data */ char es_str[100]; G_set_key_value("a", (char *)pszSemiMajor, *projinfo); sprintf(es_str, "%.16g", es); G_set_key_value("es", es_str, *projinfo); } else { /* else specify the GRASS ellps name for readability */ G_set_key_value("ellps", ellps, *projinfo); G_free(ellps); } } } /* -------------------------------------------------------------------- */ /* Finally append the detailed projection parameters to the end */ /* -------------------------------------------------------------------- */ { int i; for (i = 0; i < temp_projinfo->nitems; i++) G_set_key_value(temp_projinfo->key[i], temp_projinfo->value[i], *projinfo); G_free_key_value(temp_projinfo); } G_free(pszProj4); /* -------------------------------------------------------------------- */ /* Set the linear units. */ /* -------------------------------------------------------------------- */ *projunits = G_create_key_value(); if (OSRIsGeographic(hSRS)) { /* We assume degrees ... someday we will be wrong! */ G_set_key_value("unit", "degree", *projunits); G_set_key_value("units", "degrees", *projunits); G_set_key_value("meters", "1.0", *projunits); } else { char szFormatBuf[256]; char *pszUnitsName = NULL; double dfToMeters; char *pszUnitsPlural, *pszStringEnd; dfToMeters = OSRGetLinearUnits(hSRS, &pszUnitsName); /* Workaround for the most obvious case when unit name is unknown */ if ((G_strcasecmp(pszUnitsName, "unknown") == 0) && (dfToMeters == 1.)) G_asprintf(&pszUnitsName, "meter"); G_set_key_value("unit", pszUnitsName, *projunits); /* Attempt at plural formation (WKT format doesn't store plural * form of unit name) */ pszUnitsPlural = G_malloc(strlen(pszUnitsName) + 3); strcpy(pszUnitsPlural, pszUnitsName); pszStringEnd = pszUnitsPlural + strlen(pszUnitsPlural) - 4; if (G_strcasecmp(pszStringEnd, "foot") == 0) { /* Special case for foot - change two o's to e's */ pszStringEnd[1] = 'e'; pszStringEnd[2] = 'e'; } else if (G_strcasecmp(pszStringEnd, "inch") == 0) { /* Special case for inch - add es */ pszStringEnd[4] = 'e'; pszStringEnd[5] = 's'; pszStringEnd[6] = '\0'; } else { /* For anything else add an s at the end */ pszStringEnd[4] = 's'; pszStringEnd[5] = '\0'; } G_set_key_value("units", pszUnitsPlural, *projunits); G_free(pszUnitsPlural); sprintf(szFormatBuf, "%.16g", dfToMeters); G_set_key_value("meters", szFormatBuf, *projunits); } return 2; /* -------------------------------------------------------------------- */ /* Fallback to returning an ungeoreferenced definition. */ /* -------------------------------------------------------------------- */ default_to_xy: if (cellhd != NULL) { cellhd->proj = PROJECTION_XY; cellhd->zone = 0; } *projinfo = NULL; *projunits = NULL; return 1; }
bool rspfOgcWktTranslator::toOssimKwl( const rspfString& wktString, rspfKeywordlist &kwl, const char *prefix)const { static const char MODULE[] = "rspfOgcWktTranslator::toOssimKwl"; if(traceDebug()) { rspfNotify(rspfNotifyLevel_DEBUG) << MODULE << " entered...\n"; } const char* wkt = wktString.c_str(); OGRSpatialReferenceH hSRS = NULL; rspfDpt falseEastingNorthing; hSRS = OSRNewSpatialReference(NULL); if( OSRImportFromWkt( hSRS, (char **) &wkt ) != OGRERR_NONE ) { OSRDestroySpatialReference( hSRS ); return false; } rspfString rspfProj = ""; const char* epsg_code = OSRGetAttrValue( hSRS, "AUTHORITY", 1 ); if(traceDebug()) { rspfNotify(rspfNotifyLevel_DEBUG) << "epsg_code: " << (epsg_code?epsg_code:"null") << "\n"; } const char* units = NULL; OGR_SRSNode* node = ((OGRSpatialReference *)hSRS)->GetRoot(); int nbChild = node->GetChildCount(); for (int i = 0; i < nbChild; i++) { OGR_SRSNode* curChild = node->GetChild(i); if (strcmp(curChild->GetValue(), "UNIT") == 0) { units = curChild->GetChild(0)->GetValue(); } } if(traceDebug()) { rspfNotify(rspfNotifyLevel_DEBUG) << "units: " << (units?units:"null") << "\n"; } rspfString rspf_units; bool bGeog = OSRIsGeographic(hSRS); if ( bGeog == false ) { rspf_units = "meters"; if ( units != NULL ) { rspfString s = units; s.downcase(); if( ( s == rspfString("us survey foot") ) || ( s == rspfString("u.s. foot") ) || ( s == rspfString("foot_us") ) ) { rspf_units = "us_survey_feet"; } else if( s == rspfString("degree") ) { rspf_units = "degrees"; } else if( ( s == rspfString("meter") ) || ( s == rspfString("metre") ) ) { rspf_units = "meters"; } } } else { rspf_units = "degrees"; } if(traceDebug()) { rspfNotify(rspfNotifyLevel_DEBUG) << "rspf_units: " << rspf_units << "\n"; } if (epsg_code) { rspfString epsg_spec ("EPSG:"); epsg_spec += rspfString::toString(epsg_code); rspfProjection* proj = rspfEpsgProjectionFactory::instance()->createProjection(epsg_spec); if (proj) rspfProj = proj->getClassName(); delete proj; } if(rspfProj == "") { const char* pszProjection = OSRGetAttrValue( hSRS, "PROJECTION", 0 ); if(pszProjection) { rspfProj = wktToOssimProjection(pszProjection); } else { rspfString localCs = OSRGetAttrValue( hSRS, "LOCAL_CS", 0 ); localCs = localCs.upcase(); if(localCs == "GREATBRITAIN_GRID") { rspfProj = "rspfBngProjection"; } else if (rspf_units.contains("degree")) { rspfProj = "rspfEquDistCylProjection"; } } } if(rspfProj == "rspfEquDistCylProjection" ) rspf_units = "degrees"; kwl.add(prefix, rspfKeywordNames::UNITS_KW, rspf_units, true); if (traceDebug()) { rspfNotify(rspfNotifyLevel_DEBUG) << MODULE << "DEBUG:" << "\nrspfProj = " << rspfProj << endl; } kwl.add(prefix, rspfKeywordNames::TYPE_KW, rspfProj.c_str(), true); falseEastingNorthing.x = OSRGetProjParm(hSRS, SRS_PP_FALSE_EASTING, 0.0, NULL); falseEastingNorthing.y = OSRGetProjParm(hSRS, SRS_PP_FALSE_NORTHING, 0.0, NULL); if (epsg_code) { kwl.add(prefix, rspfKeywordNames::PCS_CODE_KW, epsg_code, true); } if(rspfProj == "rspfBngProjection") { kwl.add(prefix, rspfKeywordNames::TYPE_KW, "rspfBngProjection", true); } else if(rspfProj == "rspfCylEquAreaProjection") { kwl.add(prefix, rspfKeywordNames::STD_PARALLEL_1_KW, OSRGetProjParm(hSRS, SRS_PP_STANDARD_PARALLEL_1, 0.0, NULL), true); kwl.add(prefix, rspfKeywordNames::ORIGIN_LATITUDE_KW, OSRGetProjParm(hSRS, SRS_PP_STANDARD_PARALLEL_1, 0.0, NULL), true); rspfUnitType units = static_cast<rspfUnitType>(rspfUnitTypeLut::instance()-> getEntryNumber(rspf_units.c_str())); if ( units == RSPF_METERS || units == RSPF_FEET || units == RSPF_US_SURVEY_FEET ) { kwl.add(prefix, rspfKeywordNames::FALSE_EASTING_NORTHING_KW, falseEastingNorthing.toString(), true); kwl.add(prefix, rspfKeywordNames::FALSE_EASTING_NORTHING_UNITS_KW, rspf_units, true); } } else if(rspfProj == "rspfEquDistCylProjection") { kwl.add(prefix, rspfKeywordNames::TYPE_KW, "rspfEquDistCylProjection", true); rspfUnitType units = static_cast<rspfUnitType>(rspfUnitTypeLut::instance()-> getEntryNumber(rspf_units.c_str())); if ( units == RSPF_METERS || units == RSPF_FEET || units == RSPF_US_SURVEY_FEET ) { kwl.add(prefix, rspfKeywordNames::FALSE_EASTING_NORTHING_KW, falseEastingNorthing.toString(), true); kwl.add(prefix, rspfKeywordNames::FALSE_EASTING_NORTHING_UNITS_KW, rspf_units, true); } kwl.add(prefix, rspfKeywordNames::ORIGIN_LATITUDE_KW, OSRGetProjParm(hSRS, SRS_PP_LATITUDE_OF_ORIGIN, 0.0, NULL), true); kwl.add(prefix, rspfKeywordNames::CENTRAL_MERIDIAN_KW, OSRGetProjParm(hSRS, SRS_PP_CENTRAL_MERIDIAN, 0.0, NULL), true); } else if( (rspfProj == "rspfLambertConformalConicProjection") || (rspfProj == "rspfAlbersProjection") ) { kwl.add(prefix, rspfKeywordNames::TYPE_KW, rspfProj.c_str(), true); kwl.add(prefix, rspfKeywordNames::FALSE_EASTING_NORTHING_KW, falseEastingNorthing.toString(), true); kwl.add(prefix, rspfKeywordNames::FALSE_EASTING_NORTHING_UNITS_KW, rspf_units, true); kwl.add(prefix, rspfKeywordNames::ORIGIN_LATITUDE_KW, OSRGetProjParm(hSRS, SRS_PP_LATITUDE_OF_ORIGIN, 0.0, NULL), true); kwl.add(prefix, rspfKeywordNames::CENTRAL_MERIDIAN_KW, OSRGetProjParm(hSRS, SRS_PP_CENTRAL_MERIDIAN, 0.0, NULL), true); kwl.add(prefix, rspfKeywordNames::STD_PARALLEL_1_KW, OSRGetProjParm(hSRS, SRS_PP_STANDARD_PARALLEL_1, 0.0, NULL), true); kwl.add(prefix, rspfKeywordNames::STD_PARALLEL_2_KW, OSRGetProjParm(hSRS, SRS_PP_STANDARD_PARALLEL_2, 0.0, NULL), true); } else if(rspfProj == "rspfMercatorProjection") { kwl.add(prefix, rspfKeywordNames::TYPE_KW, "rspfMercatorProjection", true); kwl.add(prefix, rspfKeywordNames::ORIGIN_LATITUDE_KW, OSRGetProjParm(hSRS, SRS_PP_LATITUDE_OF_ORIGIN, 0.0, NULL), true); kwl.add(prefix, rspfKeywordNames::CENTRAL_MERIDIAN_KW, OSRGetProjParm(hSRS, SRS_PP_CENTRAL_MERIDIAN, 0.0, NULL), true); kwl.add(prefix, rspfKeywordNames::FALSE_EASTING_NORTHING_KW, falseEastingNorthing.toString(), true); kwl.add(prefix, rspfKeywordNames::FALSE_EASTING_NORTHING_UNITS_KW, rspf_units, true); } else if(rspfProj == "rspfSinusoidalProjection") { kwl.add(prefix, rspfKeywordNames::TYPE_KW, "rspfSinusoidalProjection", true); kwl.add(prefix, rspfKeywordNames::CENTRAL_MERIDIAN_KW, OSRGetProjParm(hSRS, SRS_PP_CENTRAL_MERIDIAN, 0.0, NULL), true); kwl.add(prefix, rspfKeywordNames::FALSE_EASTING_NORTHING_KW, falseEastingNorthing.toString(), true); kwl.add(prefix, rspfKeywordNames::FALSE_EASTING_NORTHING_UNITS_KW, rspf_units, true); } else if(rspfProj == "rspfTransMercatorProjection") { int bNorth; int nZone = OSRGetUTMZone( hSRS, &bNorth ); if( nZone != 0 ) { kwl.add(prefix, rspfKeywordNames::TYPE_KW, "rspfUtmProjection", true); kwl.add(prefix, rspfKeywordNames::ZONE_KW, nZone, true); if( bNorth ) { kwl.add(prefix, rspfKeywordNames::HEMISPHERE_KW, "N", true); } else { kwl.add(prefix, rspfKeywordNames::HEMISPHERE_KW, "S", true); } } else { kwl.add(prefix, rspfKeywordNames::TYPE_KW, "rspfTransMercatorProjection", true); kwl.add(prefix, rspfKeywordNames::SCALE_FACTOR_KW, OSRGetProjParm(hSRS, SRS_PP_SCALE_FACTOR, 1.0, NULL), true); kwl.add(prefix, rspfKeywordNames::ORIGIN_LATITUDE_KW, OSRGetProjParm(hSRS, SRS_PP_LATITUDE_OF_ORIGIN, 0.0, NULL), true); kwl.add(prefix, rspfKeywordNames::CENTRAL_MERIDIAN_KW, OSRGetProjParm(hSRS, SRS_PP_CENTRAL_MERIDIAN, 0.0, NULL), true); kwl.add(prefix, rspfKeywordNames::FALSE_EASTING_NORTHING_KW, falseEastingNorthing.toString(), true); kwl.add(prefix, rspfKeywordNames::FALSE_EASTING_NORTHING_UNITS_KW, rspf_units, true); } } else { if (traceDebug()) { rspfNotify(rspfNotifyLevel_DEBUG) << "rspfOgcWktTranslator::toOssimKwl DEBUG:\n" << "Projection conversion to RSPF not supported !!!!!!!!!\n" << "Please send the following string to the development staff\n" << "to be added to the transaltion to RSPF\n" << wkt << endl; } return false; } const char *datum = OSRGetAttrValue( hSRS, "DATUM", 0 ); rspfString oDatum = "WGE"; if( datum ) { oDatum = wktToOssimDatum(datum); if(oDatum == "") { oDatum = "WGE"; } } kwl.add(prefix, rspfKeywordNames::DATUM_KW, oDatum, true); OSRDestroySpatialReference( hSRS ); if (traceDebug()) { rspfNotify(rspfNotifyLevel_DEBUG) << MODULE << " exit status = true" << std::endl; } return true; }