PostGIS  3.1.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, "/vsi") != NULL) &&
396  (strstr(fn, "/vsimem") == NULL) &&
397  (strstr(gdal_enabled_drivers, GDAL_VSICURL) == NULL)
398  ) {
399  rterror("rt_util_gdal_open: Cannot open %s file. %s disabled", GDAL_VSICURL, GDAL_VSICURL);
400  return NULL;
401  }
402  }
403 
404  if (shared)
405  return GDALOpenShared(fn, fn_access);
406  else
407  return GDALOpen(fn, fn_access);
408 }
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: