PostGIS  3.3.9dev-r@@SVN_REVISION@@

◆ rt_util_gdal_convert_sr()

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

Definition at line 215 of file rt_util.c.

215  {
216  OGRSpatialReferenceH hsrs;
217  char *rtn = NULL;
218 
219  assert(srs != NULL);
220 
221  hsrs = OSRNewSpatialReference(NULL);
222  if (OSRSetFromUserInput(hsrs, srs) == OGRERR_NONE) {
223  if (proj4)
224  OSRExportToProj4(hsrs, &rtn);
225  else
226  OSRExportToWkt(hsrs, &rtn);
227  }
228  else {
229  rterror("rt_util_gdal_convert_sr: Could not process the provided srs: %s", srs);
230  return NULL;
231  }
232 
233  OSRDestroySpatialReference(hsrs);
234  if (rtn == NULL) {
235  rterror("rt_util_gdal_convert_sr: Could not process the provided srs: %s", srs);
236  return NULL;
237  }
238 
239  return rtn;
240 }
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: