[postgis-tickets] [SCM] PostGIS branch stable-3.1 updated. 3.1.0-5-gb11ed4d

git at osgeo.org git at osgeo.org
Thu Dec 31 14:49:57 PST 2020


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "PostGIS".

The branch, stable-3.1 has been updated
       via  b11ed4dd5494e69e4f5fa9d7d8de19a17e5addef (commit)
      from  e53c41137cebb6f71a49beaa35baf1ccb0644834 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit b11ed4dd5494e69e4f5fa9d7d8de19a17e5addef
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date:   Thu Dec 31 14:49:24 2020 -0800

    Make the VSICURL synthetic driver work as documented. Closes #4818

diff --git a/raster/rt_core/rt_util.c b/raster/rt_core/rt_util.c
index 18a68b5..f616a56 100644
--- a/raster/rt_core/rt_util.c
+++ b/raster/rt_core/rt_util.c
@@ -392,10 +392,11 @@ rt_util_gdal_open(const char *fn, GDALAccess fn_access, int shared) {
 			/* do nothing */
 		}
 		else if (
-			(strstr(fn, "/vsicurl") != NULL) &&
+			(strstr(fn, "/vsi") != NULL) &&
+			(strstr(fn, "/vsimem") == NULL) &&
 			(strstr(gdal_enabled_drivers, GDAL_VSICURL) == NULL)
 		) {
-			rterror("rt_util_gdal_open: Cannot open VSICURL file. VSICURL disabled");
+			rterror("rt_util_gdal_open: Cannot open %s file. %s disabled", GDAL_VSICURL, GDAL_VSICURL);
 			return NULL;
 		}
 	}
diff --git a/raster/rt_pg/rtpostgis.c b/raster/rt_pg/rtpostgis.c
index be97205..278115c 100644
--- a/raster/rt_pg/rtpostgis.c
+++ b/raster/rt_pg/rtpostgis.c
@@ -278,6 +278,7 @@ static void
 rtpg_assignHookGDALEnabledDrivers(const char *enabled_drivers, void *extra) {
 	int enable_all = 0;
 	int disable_all = 0;
+	int vsicurl = 0;
 
 	char **enabled_drivers_array = NULL;
 	uint32_t enabled_drivers_count = 0;
@@ -294,6 +295,8 @@ rtpg_assignHookGDALEnabledDrivers(const char *enabled_drivers, void *extra) {
 	if (enabled_drivers == NULL)
 		return;
 
+	elog(DEBUG4, "Enabling GDAL drivers: %s", enabled_drivers);
+
 	/* destroy the driver manager */
 	/* this is the only way to ensure GDAL_SKIP is recognized */
 	GDALDestroyDriverManager();
@@ -325,6 +328,14 @@ rtpg_assignHookGDALEnabledDrivers(const char *enabled_drivers, void *extra) {
 			}
 		}
 	}
+	else if (strstr(enabled_drivers, GDAL_VSICURL) != NULL) {
+		for (i = 0; i < enabled_drivers_count; i++) {
+			if (strstr(enabled_drivers_array[i], GDAL_VSICURL) != NULL) {
+				enabled_drivers_found[i] = TRUE;
+				vsicurl = 1;
+			}
+		}
+	}
 
 	if (!enable_all) {
 		int found = 0;
@@ -393,6 +404,9 @@ rtpg_assignHookGDALEnabledDrivers(const char *enabled_drivers, void *extra) {
 			elog(WARNING, "Unknown GDAL driver: %s", enabled_drivers_array[i]);
 	}
 
+	if (vsicurl)
+		elog(WARNING, "%s set.", GDAL_VSICURL);
+
 	/* destroy the driver manager */
 	/* this is the only way to ensure GDAL_SKIP is recognized */
 	GDALDestroyDriverManager();
diff --git a/raster/test/cunit/cu_misc.c b/raster/test/cunit/cu_misc.c
index 3427605..24c618d 100644
--- a/raster/test/cunit/cu_misc.c
+++ b/raster/test/cunit/cu_misc.c
@@ -134,12 +134,12 @@ static void test_util_gdal_open() {
 	CU_ASSERT(ds == NULL);
 
 	/* enabled drivers with VSICURL */
-	/* disabled as we don't want network access as a requirement
-	gdal_enabled_drivers = enabled_vsi;
-	ds = rt_util_gdal_open("/vsicurl/http://download.osgeo.org/gdal/data/gtiff/small_world.tif", GA_ReadOnly, 0);
-	CU_ASSERT(ds != NULL);
-	GDALClose(ds);
-	*/
+	/* disabled as we don't want network access as a requirement */
+	// gdal_enabled_drivers = enabled_vsi;
+	// ds = rt_util_gdal_open("/vsicurl/http://download.osgeo.org/gdal/data/gtiff/small_world.tif", GA_ReadOnly, 0);
+	// CU_ASSERT(ds != NULL);
+	// GDALClose(ds);
+
 }
 
 /* register tests */

-----------------------------------------------------------------------

Summary of changes:
 raster/rt_core/rt_util.c    |  5 +++--
 raster/rt_pg/rtpostgis.c    | 14 ++++++++++++++
 raster/test/cunit/cu_misc.c | 12 ++++++------
 3 files changed, 23 insertions(+), 8 deletions(-)


hooks/post-receive
-- 
PostGIS


More information about the postgis-tickets mailing list