Prechádzať zdrojové kódy

vlib/pg: fix creating simple features from topo - force level 2 and write also polygons without category

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@58370 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 11 rokov pred
rodič
commit
af9cbc57a5
2 zmenil súbory, kde vykonal 11 pridanie a 4 odobranie
  1. 5 1
      lib/vector/Vlib/build_pg.c
  2. 6 3
      lib/vector/Vlib/copy.c

+ 5 - 1
lib/vector/Vlib/build_pg.c

@@ -415,9 +415,13 @@ int build_topo(struct Map_info *Map, int build)
         
         /* build simple features from topogeometry data */
         p = G_find_key_value("simple_feature", key_val);
-        if (p && G_strcasecmp(p, "yes") == 0)
+        if (p && G_strcasecmp(p, "yes") == 0) {
+            if (build > GV_BUILD_BASE)
+                Map->level = LEVEL_2; /* force level to avoid errors */
+            
             if (create_simple_feature_from_topo(Map) != 0)
                 return 0;
+        }
 
         G_free_key_value(key_val);
     }

+ 6 - 3
lib/vector/Vlib/copy.c

@@ -484,12 +484,15 @@ int Vect__copy_areas(const struct Map_info *In, int field, struct Map_info *Out)
         Vect_reset_cats(Cats);
         if (field > 0) {
             cat = Vect_get_area_cat(In, area, field);
+            /* skip area without category in given layer
             if (cat == -1) {
                 nskipped++;
-                continue; /* skip area without category in given layer */
+                continue; 
             }
-            
-            Vect_cat_set(Cats, field, cat);
+            */
+
+            if (cat > 0)
+                Vect_cat_set(Cats, field, cat);
         }
 
         /* skip isles */