PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ rt_util_gdal_open()

GDALDatasetH rt_util_gdal_open ( const char *  fn,
GDALAccess  fn_access,
int  shared 
)

Definition at line 379 of file rt_util.c.

References GDAL_DISABLE_ALL, GDAL_ENABLE_ALL, gdal_enabled_drivers, GDAL_VSICURL, and rterror().

Referenced by RASTER_addBandOutDB(), RASTER_fromGDALRaster(), rt_band_load_offline_data(), and test_util_gdal_open().

379  {
380  assert(NULL != fn);
381 
382  if (gdal_enabled_drivers != NULL) {
383  if (strstr(gdal_enabled_drivers, GDAL_DISABLE_ALL) != NULL) {
384  rterror("rt_util_gdal_open: Cannot open file. All GDAL drivers disabled");
385  return NULL;
386  }
387  else if (strstr(gdal_enabled_drivers, GDAL_ENABLE_ALL) != NULL) {
388  /* do nothing */
389  }
390  else if (
391  (strstr(fn, "/vsicurl") != NULL) &&
392  (strstr(gdal_enabled_drivers, GDAL_VSICURL) == NULL)
393  ) {
394  rterror("rt_util_gdal_open: Cannot open VSICURL file. VSICURL disabled");
395  return NULL;
396  }
397  }
398 
399  if (shared)
400  return GDALOpenShared(fn, fn_access);
401  else
402  return GDALOpen(fn, fn_access);
403 }
#define GDAL_ENABLE_ALL
Definition: librtcore.h:1999
void rterror(const char *fmt,...)
Wrappers used for reporting errors and info.
Definition: rt_context.c:199
#define GDAL_DISABLE_ALL
Definition: librtcore.h:2000
char * gdal_enabled_drivers
Definition: rt_util.c:373
#define GDAL_VSICURL
Definition: librtcore.h:2001
Here is the call graph for this function:
Here is the caller graph for this function: