[GRASS-SVN] r71529 - grass/trunk/vector/v.in.ogr

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Oct 3 13:59:13 PDT 2017


Author: mmetz
Date: 2017-10-03 13:59:13 -0700 (Tue, 03 Oct 2017)
New Revision: 71529

Modified:
   grass/trunk/vector/v.in.ogr/main.c
Log:
v.in.ogr: updating to GDAL 2

Modified: grass/trunk/vector/v.in.ogr/main.c
===================================================================
--- grass/trunk/vector/v.in.ogr/main.c	2017-10-03 16:13:24 UTC (rev 71528)
+++ grass/trunk/vector/v.in.ogr/main.c	2017-10-03 20:59:13 UTC (rev 71529)
@@ -28,6 +28,7 @@
 #include <grass/gprojects.h>
 #include <grass/glocale.h>
 #include <gdal_version.h>	/* needed for OFTDate */
+#include "gdal.h"
 #include "ogr_api.h"
 #include "cpl_conv.h"
 #include "global.h"
@@ -357,6 +358,27 @@
 
 	G_message(_("Supported formats:"));
 
+#if GDAL_VERSION_NUM >= 2000000
+	for (iDriver = 0; iDriver < GDALGetDriverCount(); iDriver++) {
+	    GDALDriverH hDriver = GDALGetDriver(iDriver);
+	    const char *pszRWFlag;
+
+            if (!GDALGetMetadataItem(hDriver, GDAL_DCAP_VECTOR, NULL))
+		continue;
+
+	    if (GDALGetMetadataItem(hDriver, GDAL_DCAP_CREATE, NULL))
+		pszRWFlag = "rw+";
+	    else if (GDALGetMetadataItem(hDriver, GDAL_DCAP_CREATECOPY, NULL))
+		pszRWFlag = "rw";
+	    else
+		pszRWFlag = "ro";
+
+	    fprintf(stdout, " %s (%s): %s\n",
+		    GDALGetDriverShortName(hDriver),
+		    pszRWFlag, GDALGetDriverLongName(hDriver));
+	}
+
+#else
 	for (iDriver = 0; iDriver < OGRGetDriverCount(); iDriver++) {
 	    OGRSFDriverH poDriver = OGRGetDriver(iDriver);
 	    const char *pszRWFlag;
@@ -370,6 +392,7 @@
 		    OGR_Dr_GetName(poDriver),
 		    pszRWFlag, OGR_Dr_GetName(poDriver));
 	}
+#endif
 	exit(EXIT_SUCCESS);
     }
 



More information about the grass-commit mailing list