225 {
226 OGRSpatialReferenceH hsrs;
227 char *rtn = NULL;
228
229 assert(srs != NULL);
230
231 hsrs = OSRNewSpatialReference(NULL);
232 if (OSRSetFromUserInput(hsrs, srs) == OGRERR_NONE) {
233 if (proj4)
234 OSRExportToProj4(hsrs, &rtn);
235 else
236 OSRExportToWkt(hsrs, &rtn);
237 }
238 else {
239 rterror(
"rt_util_gdal_convert_sr: Could not process the provided srs: %s", srs);
240 return NULL;
241 }
242
243 OSRDestroySpatialReference(hsrs);
244 if (rtn == NULL) {
245 rterror(
"rt_util_gdal_convert_sr: Could not process the provided srs: %s", srs);
246 return NULL;
247 }
248
249 return rtn;
250}
void rterror(const char *fmt,...) __attribute__((format(printf
Wrappers used for reporting errors and info.