[GRASS-SVN] r58370 - grass/trunk/lib/vector/Vlib

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Dec 3 04:02:47 PST 2013


Author: martinl
Date: 2013-12-03 04:02:47 -0800 (Tue, 03 Dec 2013)
New Revision: 58370

Modified:
   grass/trunk/lib/vector/Vlib/build_pg.c
   grass/trunk/lib/vector/Vlib/copy.c
Log:
vlib/pg: fix creating simple features from topo - force level 2 and write also polygons without category

Modified: grass/trunk/lib/vector/Vlib/build_pg.c
===================================================================
--- grass/trunk/lib/vector/Vlib/build_pg.c	2013-12-03 11:52:07 UTC (rev 58369)
+++ grass/trunk/lib/vector/Vlib/build_pg.c	2013-12-03 12:02:47 UTC (rev 58370)
@@ -415,9 +415,13 @@
         
         /* 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);
     }

Modified: grass/trunk/lib/vector/Vlib/copy.c
===================================================================
--- grass/trunk/lib/vector/Vlib/copy.c	2013-12-03 11:52:07 UTC (rev 58369)
+++ grass/trunk/lib/vector/Vlib/copy.c	2013-12-03 12:02:47 UTC (rev 58370)
@@ -484,12 +484,15 @@
         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 */



More information about the grass-commit mailing list