PostGIS  2.5.0beta2dev-r@@SVN_REVISION@@

◆ rt_util_gdal_open()

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

Definition at line 381 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(), rt_band_new_offline_from_path(), and test_util_gdal_open().

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