398 {
399 char *vsi_options_str =
rtoptions(
"gdal_vsi_options");
400
401
402 if (vsi_options_str && strlen(vsi_options_str) > 0) {
403 size_t sz;
405 rtinfo(
"postgis.gdal_vsi_options is set");
406 memset(olist, 0, sizeof(olist));
409 if (sz % 2 == 0) {
410 size_t i;
411 for (i = 0; i < sz; i += 2)
412 {
413 char *key = olist[i];
414 char *val = olist[i+1];
415
416
417 if (strcmp(key, "gdal_skip") == 0) {
418 rtwarn(
"Unable to set GDAL_SKIP config option");
419 continue;
420 }
421 rtinfo(
"CPLSetConfigOption(%s)", key);
422 CPLSetConfigOption(key, val);
423 }
424 }
425 }
426
427 unsigned int open_flags;
428 assert(NULL != fn);
429
432 rterror(
"rt_util_gdal_open: Cannot open file. All GDAL drivers disabled");
433 return NULL;
434 }
436
437 }
438 else if (
439 (strstr(fn, "/vsi") != NULL) &&
440 (strstr(fn, "/vsimem") == NULL) &&
442 ) {
444 return NULL;
445 }
446 }
447
448 open_flags = GDAL_OF_RASTER
449 | GDAL_OF_VERBOSE_ERROR
450 | (fn_access == GA_Update ? GDAL_OF_UPDATE : 0)
451 | (shared ? GDAL_OF_SHARED : 0);
452
453 return GDALOpenEx(fn ,
454 open_flags,
455 NULL,
456 NULL,
457 NULL
458 );
459}
void rterror(const char *fmt,...) __attribute__((format(printf
Wrappers used for reporting errors and info.
void void rtinfo(const char *fmt,...) __attribute__((format(printf
void void void rtwarn(const char *fmt,...) __attribute__((format(printf
void void void char * rtoptions(const char *varname)
Wrappers used for options.
size_t option_list_length(char **olist)
Returns the total number of keys and values in the list.
void option_list_parse(char *input, char **olist)
option_list is a null-terminated list of strings, where every odd string is a key and every even stri...
char * gdal_enabled_drivers