282 char **enabled_drivers_array = NULL;
284 bool *enabled_drivers_found = NULL;
285 char *gdal_skip = NULL;
294 if (enabled_drivers == NULL)
299 GDALDestroyDriverManager();
300 CPLSetConfigOption(
"GDAL_SKIP", NULL);
305 enabled_drivers_array =
rtpg_strsplit(enabled_drivers,
" ", &enabled_drivers_count);
306 enabled_drivers_found = palloc(
sizeof(
bool) * enabled_drivers_count);
307 memset(enabled_drivers_found,
FALSE,
sizeof(
bool) * enabled_drivers_count);
313 for (i = 0; i < enabled_drivers_count; i++) {
315 enabled_drivers_found[i] =
TRUE;
321 for (i = 0; i < enabled_drivers_count; i++) {
323 enabled_drivers_found[i] =
TRUE;
337 for (i = 0; i < drv_count; i++) {
342 if (strstr(enabled_drivers, drv_set[i].short_name) != NULL) {
344 for (j = 0; j < enabled_drivers_count; j++) {
346 if (strcmp(enabled_drivers_array[j], drv_set[i].short_name) == 0) {
347 enabled_drivers_found[j] =
TRUE;
359 if (gdal_skip == NULL) {
360 gdal_skip = palloc(
sizeof(
char) * (strlen(drv_set[i].short_name) + 1));
364 gdal_skip = repalloc(
367 strlen(gdal_skip) + 1 + strlen(drv_set[i].short_name) + 1
370 strcat(gdal_skip,
" ");
372 strcat(gdal_skip, drv_set[i].short_name);
375 for (i = 0; i < drv_count; i++) {
376 pfree(drv_set[i].short_name);
377 pfree(drv_set[i].long_name);
378 pfree(drv_set[i].create_options);
380 if (drv_count) pfree(drv_set);
384 for (i = 0; i < enabled_drivers_count; i++) {
385 if (enabled_drivers_found[i])
389 elog(WARNING,
"%s set. Ignoring GDAL driver: %s",
GDAL_DISABLE_ALL, enabled_drivers_array[i]);
391 elog(WARNING,
"%s set. Ignoring GDAL driver: %s",
GDAL_ENABLE_ALL, enabled_drivers_array[i]);
393 elog(WARNING,
"Unknown GDAL driver: %s", enabled_drivers_array[i]);
398 GDALDestroyDriverManager();
402 CPLSetConfigOption(
"GDAL_SKIP", gdal_skip);
403 if (gdal_skip != NULL) pfree(gdal_skip);
408 pfree(enabled_drivers_array);
409 pfree(enabled_drivers_found);
int rt_util_gdal_register_all(int force_register_all)
rt_gdaldriver rt_raster_gdal_drivers(uint32_t *drv_count, uint8_t cancc)
Returns a set of available GDAL drivers.
char ** rtpg_strsplit(const char *str, const char *delimiter, uint32_t *n)
#define POSTGIS_RT_DEBUGF(level, msg,...)