Преглед на файлове

v.in.ogr key flag does not change category values and you loose connection between features and attributes (see https://trac.osgeo.org/grass/ticket/1494)

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@69241 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa преди 8 години
родител
ревизия
b9c6bef759
променени са 1 файла, в които са добавени 7 реда и са изтрити 1 реда
  1. 7 1
      vector/v.in.ogr/main.c

+ 7 - 1
vector/v.in.ogr/main.c

@@ -1458,8 +1458,14 @@ int main(int argc, char *argv[])
 	    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++) {