[GRASS-SVN] r55693 - in grass/trunk/vector: v.edit v.out.postgis
svn_grass at osgeo.org
svn_grass at osgeo.org
Wed Apr 10 13:37:27 PDT 2013
Author: martinl
Date: 2013-04-10 13:37:27 -0700 (Wed, 10 Apr 2013)
New Revision: 55693
Modified:
grass/trunk/vector/v.edit/main.c
grass/trunk/vector/v.out.postgis/create.c
Log:
v.edit/v.out.postgis: remove V2_open_new_ogr|pg()
new OGR/PG layer is created by Vect_write_line()
Modified: grass/trunk/vector/v.edit/main.c
===================================================================
--- grass/trunk/vector/v.edit/main.c 2013-04-10 20:35:47 UTC (rev 55692)
+++ grass/trunk/vector/v.edit/main.c 2013-04-10 20:37:27 UTC (rev 55693)
@@ -3,13 +3,13 @@
*
* MODULE: v.edit
*
- * PURPOSE: Editing vector map.
+ * PURPOSE: Non-interactive editing vector map.
*
* AUTHOR(S): Wolf Bergenheim
* Jachym Cepicky
- * Update for GRASS 7 by Martin Landa <landa.martin gmail.com>
+ * Major updates by Martin Landa <landa.martin gmail.com>
*
- * COPYRIGHT: (C) 2006-2011 by the GRASS Development Team
+ * COPYRIGHT: (C) 2006-2011, 2013 by the GRASS Development Team
*
* This program is free software under the GNU General
* Public License (>=v2). Read the file COPYING that comes
@@ -96,27 +96,25 @@
}
/* 3D vector maps? */
+ putenv("GRASS_VECTOR_EXTERNAL_IMMEDIATE=1");
ret = Vect_open_new(&Map, params.map->answer, WITHOUT_Z);
if (ret == -1) {
G_fatal_error(_("Unable to create vector map <%s>"),
params.map->answer);
}
-
+ Vect_set_error_handler_io(NULL, &Map);
+
/* native or external data source ? */
map_type = Vect_maptype(&Map);
if (map_type != GV_FORMAT_NATIVE) {
int type;
type = Vect_option_to_types(params.type);
- if (type != GV_POINT && type != GV_LINE &&
- type != GV_BOUNDARY)
- G_fatal_error(_("Supported feature type for OGR layer: "
- "%s, %s or %s"), "point", "line", "boundary");
- if (map_type == GV_FORMAT_POSTGIS)
- ret = V2_open_new_pg(&Map, type);
- else
- ret = V2_open_new_ogr(&Map, type);
- if (ret != 0)
- G_fatal_error(_("Unable to create vector map <%s>"),
+ if (type != GV_POINT && !(type & GV_LINES))
+ G_fatal_error("%s: point,line,boundary",
+ _("Supported feature types for non-native formats:"));
+ /* create OGR or PostGIS layer */
+ if (Vect_write_line(&Map, type, NULL, NULL) < 0)
+ G_fatal_error(_("Unable to create vector map <%s>"),
params.map->answer);
}
Modified: grass/trunk/vector/v.out.postgis/create.c
===================================================================
--- grass/trunk/vector/v.out.postgis/create.c 2013-04-10 20:35:47 UTC (rev 55692)
+++ grass/trunk/vector/v.out.postgis/create.c 2013-04-10 20:37:27 UTC (rev 55693)
@@ -23,7 +23,7 @@
type = Vect_read_next_line(In, NULL, NULL);
Vect_rewind(In);
- if (V2_open_new_pg(Out, type) < 0)
+ if (Vect_write_line(Out, type, NULL, NULL) < 0)
G_fatal_error(_("Unable to create PostGIS layer <%s>"),
Vect_get_finfo_layer_name(Out));
}
More information about the grass-commit
mailing list