[GRASS-SVN] r60485 - in grass/branches/releasebranch_7_0/raster: r.external r.external.out r.in.gdal r.out.gdal

svn_grass at osgeo.org svn_grass at osgeo.org
Sun May 25 14:43:38 PDT 2014


Author: martinl
Date: 2014-05-25 14:43:37 -0700 (Sun, 25 May 2014)
New Revision: 60485

Modified:
   grass/branches/releasebranch_7_0/raster/r.external.out/main.c
   grass/branches/releasebranch_7_0/raster/r.external/list.c
   grass/branches/releasebranch_7_0/raster/r.in.gdal/main.c
   grass/branches/releasebranch_7_0/raster/r.out.gdal/main.c
Log:
r.in.gdal/r.out.gdal/r.external/r.external.out: Starting with GDAL 2.0, vector drivers can also be returned (fix -f flag)
   (merge r60479, 60481-84 from trunk)                                              


Modified: grass/branches/releasebranch_7_0/raster/r.external/list.c
===================================================================
--- grass/branches/releasebranch_7_0/raster/r.external/list.c	2014-05-25 21:39:04 UTC (rev 60484)
+++ grass/branches/releasebranch_7_0/raster/r.external/list.c	2014-05-25 21:43:37 UTC (rev 60485)
@@ -24,6 +24,13 @@
 	GDALDriverH hDriver = GDALGetDriver(iDr);
 	const char *pszRWFlag;
 
+#ifdef GDAL_DCAP_RASTER
+            /* Starting with GDAL 2.0, vector drivers can also be returned */
+            /* Only keep raster drivers */
+            if (!GDALGetMetadataItem(hDriver, GDAL_DCAP_RASTER, NULL))
+                continue;
+#endif
+
 	if (GDALGetMetadataItem(hDriver, GDAL_DCAP_CREATE, NULL))
 	    pszRWFlag = "rw+";
 	else if (GDALGetMetadataItem(hDriver, GDAL_DCAP_CREATECOPY, NULL))

Modified: grass/branches/releasebranch_7_0/raster/r.external.out/main.c
===================================================================
--- grass/branches/releasebranch_7_0/raster/r.external.out/main.c	2014-05-25 21:39:04 UTC (rev 60484)
+++ grass/branches/releasebranch_7_0/raster/r.external.out/main.c	2014-05-25 21:43:37 UTC (rev 60485)
@@ -40,6 +40,13 @@
 	GDALDriverH hDriver = GDALGetDriver(iDr);
 	const char *pszRWFlag;
 
+#ifdef GDAL_DCAP_RASTER
+            /* Starting with GDAL 2.0, vector drivers can also be returned */
+            /* Only keep raster drivers */
+            if (!GDALGetMetadataItem(hDriver, GDAL_DCAP_RASTER, NULL))
+                continue;
+#endif
+
 	if (GDALGetMetadataItem(hDriver, GDAL_DCAP_CREATE, NULL))
 	    pszRWFlag = "rw+";
 	else if (GDALGetMetadataItem(hDriver, GDAL_DCAP_CREATECOPY, NULL))
@@ -63,6 +70,13 @@
     for (i = 0; i < GDALGetDriverCount(); i++) {
 	GDALDriverH driver = GDALGetDriver(i);
 
+#ifdef GDAL_DCAP_RASTER
+            /* Starting with GDAL 2.0, vector drivers can also be returned */
+            /* Only keep raster drivers */
+            if (!GDALGetMetadataItem(driver, GDAL_DCAP_RASTER, NULL))
+                continue;
+#endif
+
 	if (!GDALGetMetadataItem(driver, GDAL_DCAP_CREATE, NULL) &&
 	    !GDALGetMetadataItem(driver, GDAL_DCAP_CREATECOPY, NULL))
 	    continue;
@@ -77,6 +91,13 @@
 	GDALDriverH driver = GDALGetDriver(i);
 	const char *name;
 
+#ifdef GDAL_DCAP_RASTER
+            /* Starting with GDAL 2.0, vector drivers can also be returned */
+            /* Only keep raster drivers */
+            if (!GDALGetMetadataItem(driver, GDAL_DCAP_RASTER, NULL))
+                continue;
+#endif
+
 	if (!GDALGetMetadataItem(driver, GDAL_DCAP_CREATE, NULL) &&
 	    !GDALGetMetadataItem(driver, GDAL_DCAP_CREATECOPY, NULL))
 	    continue;

Modified: grass/branches/releasebranch_7_0/raster/r.in.gdal/main.c
===================================================================
--- grass/branches/releasebranch_7_0/raster/r.in.gdal/main.c	2014-05-25 21:39:04 UTC (rev 60484)
+++ grass/branches/releasebranch_7_0/raster/r.in.gdal/main.c	2014-05-25 21:43:37 UTC (rev 60485)
@@ -216,11 +216,18 @@
     if (flag_f->answer) {
 	int iDr;
 
-	G_message(_("Available GDAL Drivers:"));
+	G_message(_("Supported formats:"));
 	for (iDr = 0; iDr < GDALGetDriverCount(); iDr++) {
 	    GDALDriverH hDriver = GDALGetDriver(iDr);
 	    const char *pszRWFlag;
 
+#ifdef GDAL_DCAP_RASTER
+            /* Starting with GDAL 2.0, vector drivers can also be returned */
+            /* Only keep raster drivers */
+            if (!GDALGetMetadataItem(hDriver, GDAL_DCAP_RASTER, NULL))
+                continue;
+#endif
+
 	    if (GDALGetMetadataItem(hDriver, GDAL_DCAP_CREATE, NULL))
 		pszRWFlag = "rw+";
 	    else if (GDALGetMetadataItem(hDriver, GDAL_DCAP_CREATECOPY, NULL))

Modified: grass/branches/releasebranch_7_0/raster/r.out.gdal/main.c
===================================================================
--- grass/branches/releasebranch_7_0/raster/r.out.gdal/main.c	2014-05-25 21:39:04 UTC (rev 60484)
+++ grass/branches/releasebranch_7_0/raster/r.out.gdal/main.c	2014-05-25 21:43:37 UTC (rev 60485)
@@ -54,12 +54,19 @@
 	GDALDriverH hDriver = GDALGetDriver(iDr);
 	const char *pszRWFlag;
 
+#ifdef GDAL_DCAP_RASTER
+            /* Starting with GDAL 2.0, vector drivers can also be returned */
+            /* Only keep raster drivers */
+            if (!GDALGetMetadataItem(hDriver, GDAL_DCAP_RASTER, NULL))
+                continue;
+#endif
+
 	if (GDALGetMetadataItem(hDriver, GDAL_DCAP_CREATE, NULL))
 	    pszRWFlag = "rw+";
 	else if (GDALGetMetadataItem(hDriver, GDAL_DCAP_CREATECOPY, NULL))
 	    pszRWFlag = "rw";
 	else
-	    pszRWFlag = "ro";
+          continue;
 
 	if (*formats)
 	    fprintf(stdout, "  %s (%s): %s\n",



More information about the grass-commit mailing list