PostGIS 3.0.6dev-r@@SVN_REVISION@@
Loading...
Searching...
No Matches

◆ rt_util_gdal_convert_sr()

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

Definition at line 214 of file rt_util.c.

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.
Definition rt_context.c:199

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: