浏览代码

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

git-svn-id: https://svn.osgeo.org/grass/grass/branches/releasebranch_7_0@69251 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 8 年之前
父节点
当前提交
987c244869
共有 1 个文件被更改,包括 7 次插入1 次删除
  1. 7 1
      vector/v.in.ogr/main.c

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

@@ -1485,8 +1485,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++) {