PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ rt_util_gdal_convert_sr()

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

Definition at line 212 of file rt_util.c.

References rterror().

Referenced by rt_raster_gdal_warp(), and rt_raster_to_gdal_mem().

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