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

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Aug 23 07:43:29 PDT 2016


Author: martinl
Date: 2016-08-23 07:43:28 -0700 (Tue, 23 Aug 2016)
New Revision: 69241

Modified:
   grass/trunk/vector/v.in.ogr/main.c
Log:
v.in.ogr key flag does not change category values and you loose connection between features and attributes (see #1494)


Modified: grass/trunk/vector/v.in.ogr/main.c
===================================================================
--- grass/trunk/vector/v.in.ogr/main.c	2016-08-23 14:37:02 UTC (rev 69240)
+++ grass/trunk/vector/v.in.ogr/main.c	2016-08-23 14:43:28 UTC (rev 69241)
@@ -1458,8 +1458,14 @@
 	    cat = 0;		/* field = layer + 1 */
 	    G_percent(cat, n_features, 2);
 	    while ((Ogr_feature = OGR_L_GetNextFeature(Ogr_layer)) != NULL) {
-		cat++;
 		G_percent(cat, n_features, 2);
+
+                /* Category */
+                if (key_idx > -1)
+                    cat = OGR_F_GetFieldAsInteger(Ogr_feature, key_idx);
+                else
+                    cat++;
+
 		/* Geometry */
 #if GDAL_VERSION_NUM >= 1110000
                 for (i = 0; i < OGR_FD_GetGeomFieldCount(Ogr_featuredefn); i++) {



More information about the grass-commit mailing list