[GRASS-SVN] r69251 - grass/branches/releasebranch_7_0/vector/v.in.ogr

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Aug 24 08:50:26 PDT 2016


Author: martinl
Date: 2016-08-24 08:50:26 -0700 (Wed, 24 Aug 2016)
New Revision: 69251

Modified:
   grass/branches/releasebranch_7_0/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 (fix #1494) (merge r69241 from trunk)


Modified: grass/branches/releasebranch_7_0/vector/v.in.ogr/main.c
===================================================================
--- grass/branches/releasebranch_7_0/vector/v.in.ogr/main.c	2016-08-24 15:46:27 UTC (rev 69250)
+++ grass/branches/releasebranch_7_0/vector/v.in.ogr/main.c	2016-08-24 15:50:26 UTC (rev 69251)
@@ -1485,8 +1485,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