[GRASS-SVN] r70248 - grass/branches/releasebranch_7_0/lib/vector/Vlib

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


Author: martinl
Date: 2017-01-04 08:56:08 -0800 (Wed, 04 Jan 2017)
New Revision: 70248

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

Modified: grass/branches/releasebranch_7_0/lib/vector/Vlib/read_pg.c
===================================================================
--- grass/branches/releasebranch_7_0/lib/vector/Vlib/read_pg.c	2017-01-04 16:51:27 UTC (rev 70247)
+++ grass/branches/releasebranch_7_0/lib/vector/Vlib/read_pg.c	2017-01-04 16:56:08 UTC (rev 70248)
@@ -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 */
@@ -1628,7 +1628,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;
@@ -1660,6 +1660,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