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

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Jan 4 08:51:27 PST 2017


Author: martinl
Date: 2017-01-04 08:51:27 -0800 (Wed, 04 Jan 2017)
New Revision: 70247

Modified:
   grass/trunk/lib/vector/Vlib/read_pg.c
Log:
vlib/pg: report categories also for centroids (it fixes eg. v.out.ascii map=pglink format=wkt)

Modified: grass/trunk/lib/vector/Vlib/read_pg.c
===================================================================
--- grass/trunk/lib/vector/Vlib/read_pg.c	2017-01-04 14:38:51 UTC (rev 70246)
+++ grass/trunk/lib/vector/Vlib/read_pg.c	2017-01-04 16:51:27 UTC (rev 70247)
@@ -54,7 +54,7 @@
                                         struct feat_parts *);
 static int error_corrupted_data(const char *);
 static void add_fpart(struct feat_parts *, SF_FeatureType, int, int);
-static int get_centroid(struct Map_info *, int, struct line_pnts *);
+static int get_centroid(struct Map_info *, int, struct line_pnts *, struct line_cats *);
 static void error_tuples(struct Format_info_pg *);
 #endif
 
@@ -348,7 +348,7 @@
         Vect_reset_line(line_p);
     if (Line->type == GV_CENTROID && !pg_info->toposchema_name) {
         /* simple features access: get centroid from sidx */
-        return get_centroid(Map, line, line_p);
+        return get_centroid(Map, line, line_p, line_c);
     }
     
     /* get feature id */
@@ -1633,7 +1633,7 @@
   \return -1 on error
 */
 int get_centroid(struct Map_info *Map, int centroid,
-                 struct line_pnts *line_p)
+                 struct line_pnts *line_p, struct line_cats *line_c)
 {
     int i, found;
     struct bound_box box;
@@ -1665,6 +1665,9 @@
         Vect_reset_line(line_p);
         Vect_append_point(line_p, list.box[found].E, list.box[found].N, 0.0);
     }
+    if (line_c) {
+        Vect_cat_set(line_c, 1, topo->area);
+    }
     
     return GV_CENTROID;
 }



More information about the grass-commit mailing list