MCPcopy Create free account
hub / github.com/MapServer/MapServer / msOGCWKT2ProjectionObj

Function msOGCWKT2ProjectionObj

mapogr.cpp:1214–1258  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1212 **********************************************************************/
1213
1214int msOGCWKT2ProjectionObj( const char *pszWKT,
1215 projectionObj *proj,
1216 int debug_flag )
1217
1218{
1219#if defined(USE_OGR) || defined(USE_GDAL)
1220
1221 OGRSpatialReferenceH hSRS;
1222 char *pszAltWKT = (char *) pszWKT;
1223 OGRErr eErr;
1224 int ms_result;
1225
1226 ACQUIRE_OLD_OGR_LOCK;
1227 hSRS = OSRNewSpatialReference( NULL );
1228
1229 if( !EQUALN(pszWKT,"GEOGCS",6)
1230 && !EQUALN(pszWKT,"PROJCS",6)
1231 && !EQUALN(pszWKT,"LOCAL_CS",8) )
1232 eErr = OSRSetFromUserInput( hSRS, pszWKT );
1233 else
1234 eErr = OSRImportFromWkt( hSRS, &pszAltWKT );
1235
1236 RELEASE_OLD_OGR_LOCK;
1237
1238 if( eErr != OGRERR_NONE )
1239 {
1240 OSRDestroySpatialReference( hSRS );
1241 msSetError(MS_OGRERR,
1242 "Ingestion of WKT string '%s' failed.",
1243 "msOGCWKT2ProjectionObj()",
1244 pszWKT );
1245 return MS_FAILURE;
1246 }
1247
1248 ms_result = msOGRSpatialRef2ProjectionObj( hSRS, proj, debug_flag );
1249
1250 OSRDestroySpatialReference( hSRS );
1251 return ms_result;
1252#else
1253 msSetError(MS_OGRERR,
1254 "Not implemented since neither OGR nor GDAL is enabled.",
1255 "msOGCWKT2ProjectionObj()");
1256 return MS_FAILURE;
1257#endif
1258}
1259
1260/**********************************************************************
1261 * msOGRFileOpen()

Callers 6

msRasterQueryByRectFunction · 0.85
msDrawRasterLayerLowFunction · 0.85
mapObj_setWKTProjectionFunction · 0.85

Calls 2

msSetErrorFunction · 0.85

Tested by

no test coverage detected