214 {
215 OGRSpatialReferenceH hsrs;
216 char *rtn = NULL;
217
218 assert(srs != NULL);
219
220 hsrs = OSRNewSpatialReference(NULL);
221 if (OSRSetFromUserInput(hsrs, srs) == OGRERR_NONE) {
222 if (proj4)
223 OSRExportToProj4(hsrs, &rtn);
224 else
225 OSRExportToWkt(hsrs, &rtn);
226 }
227 else {
228 rterror(
"rt_util_gdal_convert_sr: Could not process the provided srs: %s", srs);
229 return NULL;
230 }
231
232 OSRDestroySpatialReference(hsrs);
233 if (rtn == NULL) {
234 rterror(
"rt_util_gdal_convert_sr: Could not process the provided srs: %s", srs);
235 return NULL;
236 }
237
238 return rtn;
239}
void rterror(const char *fmt,...)
Wrappers used for reporting errors and info.