PostGIS  3.0.6dev-r@@SVN_REVISION@@

◆ rt_util_gdal_open()

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

Definition at line 383 of file rt_util.c.

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

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().

Here is the call graph for this function:
Here is the caller graph for this function: