322 {
323 OGRSpatialReferenceH hsrs;
324 char *rtn = NULL;
325
326 assert(srs != NULL);
327
328 hsrs = OSRNewSpatialReference(NULL);
329 if (OSRSetFromUserInput(hsrs, srs) == OGRERR_NONE) {
330 if (proj4)
331 OSRExportToProj4(hsrs, &rtn);
332 else
333 OSRExportToWkt(hsrs, &rtn);
334 }
335 else {
336 rterror(
"rt_util_gdal_convert_sr: Could not process the provided srs: %s", srs);
337 return NULL;
338 }
339
340 OSRDestroySpatialReference(hsrs);
341 if (rtn == NULL) {
342 rterror(
"rt_util_gdal_convert_sr: Could not process the provided srs: %s", srs);
343 return NULL;
344 }
345
346 return rtn;
347}
void rterror(const char *fmt,...) __attribute__((format(printf
Wrappers used for reporting errors and info.