[GRASS-SVN] r60483 - in grass/trunk/raster: r.external.out r.in.gdal r.out.gdal
svn_grass at osgeo.org
svn_grass at osgeo.org
Sun May 25 14:31:01 PDT 2014
Author: martinl
Date: 2014-05-25 14:31:01 -0700 (Sun, 25 May 2014)
New Revision: 60483
Modified:
grass/trunk/raster/r.external.out/main.c
grass/trunk/raster/r.in.gdal/main.c
grass/trunk/raster/r.out.gdal/main.c
Log:
r.external.out: Starting with GDAL 2.0, vector drivers can also be returned (fix -f flag)
Modified: grass/trunk/raster/r.external.out/main.c
===================================================================
--- grass/trunk/raster/r.external.out/main.c 2014-05-25 21:24:19 UTC (rev 60482)
+++ grass/trunk/raster/r.external.out/main.c 2014-05-25 21:31:01 UTC (rev 60483)
@@ -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(hDriver, GDAL_DCAP_RASTER, NULL))
+ continue;
+#endif
+
if (!GDALGetMetadataItem(driver, GDAL_DCAP_CREATE, NULL) &&
!GDALGetMetadataItem(driver, GDAL_DCAP_CREATECOPY, NULL))
continue;
Modified: grass/trunk/raster/r.in.gdal/main.c
===================================================================
--- grass/trunk/raster/r.in.gdal/main.c 2014-05-25 21:24:19 UTC (rev 60482)
+++ grass/trunk/raster/r.in.gdal/main.c 2014-05-25 21:31:01 UTC (rev 60483)
@@ -216,7 +216,7 @@
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;
Modified: grass/trunk/raster/r.out.gdal/main.c
===================================================================
--- grass/trunk/raster/r.out.gdal/main.c 2014-05-25 21:24:19 UTC (rev 60482)
+++ grass/trunk/raster/r.out.gdal/main.c 2014-05-25 21:31:01 UTC (rev 60483)
@@ -66,7 +66,7 @@
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