[GRASS-SVN] r53275 - grass/trunk/vector/v.to.points
svn_grass at osgeo.org
svn_grass at osgeo.org
Thu Sep 27 04:33:22 PDT 2012
Author: marisn
Date: 2012-09-27 04:33:21 -0700 (Thu, 27 Sep 2012)
New Revision: 53275
Modified:
grass/trunk/vector/v.to.points/main.c
Log:
Don't write original line cat, if user requested to ignore CATs. Enhances r53273
Modified: grass/trunk/vector/v.to.points/main.c
===================================================================
--- grass/trunk/vector/v.to.points/main.c 2012-09-27 08:19:24 UTC (rev 53274)
+++ grass/trunk/vector/v.to.points/main.c 2012-09-27 11:33:21 UTC (rev 53275)
@@ -53,15 +53,19 @@
Vect_cat_set(PCats, 2, point_cat);
}
else {
- Vect_cat_set(PCats, 1, point_cat);
+ Vect_cat_set(PCats, 2, point_cat);
}
Vect_write_line(Out, GV_POINT, PPoints, PCats);
/* Attributes */
if (!table) {
db_zero_string(&stmt);
- sprintf(buf, "insert into %s values ( %d, %d, %.15g )", Fi->table,
- point_cat, line_cat, along);
+ if (line_cat > 0)
+ sprintf(buf, "insert into %s values ( %d, %d, %.15g )", Fi->table,
+ point_cat, line_cat, along);
+ else
+ sprintf(buf, "insert into %s values ( %d, %.15g )", Fi->table,
+ point_cat, along);
db_append_string(&stmt, buf);
if (db_execute_immediate(driver, &stmt) != DB_OK) {
@@ -286,7 +290,12 @@
G_fatal_error(_("Unable to open database <%s> by driver <%s>"),
Fi->database, Fi->driver);
- sprintf(buf,
+ if (field == -1)
+ sprintf(buf,
+ "create table %s ( cat int, along double precision )",
+ Fi->table);
+ else
+ sprintf(buf,
"create table %s ( cat int, lcat int, along double precision )",
Fi->table);
db_append_string(&stmt, buf);
More information about the grass-commit
mailing list