PostGIS  3.4.0dev-r@@SVN_REVISION@@

◆ rt_util_gdal_convert_sr()

char* rt_util_gdal_convert_sr ( const char *  srs,
int  proj4 
)

Definition at line 218 of file rt_util.c.

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

References rterror().

Referenced by rt_raster_gdal_warp(), and rt_raster_to_gdal_mem().

Here is the call graph for this function:
Here is the caller graph for this function: