[GRASS-SVN] r56476 - in grass/trunk: lib/init lib/vector/Vlib vector/v.external

svn_grass at osgeo.org svn_grass at osgeo.org
Wed May 29 06:46:20 PDT 2013


Author: martinl
Date: 2013-05-29 06:46:17 -0700 (Wed, 29 May 2013)
New Revision: 56476

Modified:
   grass/trunk/lib/init/variables.html
   grass/trunk/lib/vector/Vlib/copy.c
   grass/trunk/lib/vector/Vlib/open.c
   grass/trunk/vector/v.external/main.c
Log:
vlib: add GRASS_VECTOR_EXTERNAL_IGNORE variable
      update v.external to use this variable


Modified: grass/trunk/lib/init/variables.html
===================================================================
--- grass/trunk/lib/init/variables.html	2013-05-29 12:48:06 UTC (rev 56475)
+++ grass/trunk/lib/init/variables.html	2013-05-29 13:46:17 UTC (rev 56476)
@@ -253,6 +253,12 @@
     format, then the vector library writes features immediately to output
     database (in this case GRASS_VECTOR_EXTERNAL_IMMEDIATE is ignored).</dd>
 
+  <dt>GRASS_VECTOR_EXTERNAL_IGNORE</dt>
+  <dd>[vectorlib]<br> If the environment variable
+    GRASS_VECTOR_EXTERNAL_IGNORE exists, output vector format defined
+    by <em><a href="v.external.out.html">v.external.out</a></em> is
+    ignored. The format is always native.</dd>
+
   <dt>GRASS_WXBUNDLED</dt>
   <dd>[wxGUI]<br>
     set to tell wxGUI that a bundled wxPython will be used.<br>

Modified: grass/trunk/lib/vector/Vlib/copy.c
===================================================================
--- grass/trunk/lib/vector/Vlib/copy.c	2013-05-29 12:48:06 UTC (rev 56475)
+++ grass/trunk/lib/vector/Vlib/copy.c	2013-05-29 13:46:17 UTC (rev 56476)
@@ -474,7 +474,8 @@
     /* copy areas */
     nskipped = 0;
     nareas = Vect_get_num_areas(In);
-    G_message(_("Exporting areas..."));
+    if (nareas > 0)
+        G_message(_("Exporting areas..."));
     for (area = 1; area <= nareas; area++) {
         G_debug(3, "area = %d", area);
         G_percent(area, nareas, 3);

Modified: grass/trunk/lib/vector/Vlib/open.c
===================================================================
--- grass/trunk/lib/vector/Vlib/open.c	2013-05-29 12:48:06 UTC (rev 56475)
+++ grass/trunk/lib/vector/Vlib/open.c	2013-05-29 13:46:17 UTC (rev 56476)
@@ -725,11 +725,8 @@
     Map->temporary = is_tmp;
     
     /* determine output format */
-    if (strcmp(G_program_name(), "v.external") != 0)
-        Map->format = map_format(Map);
-    else
-        Map->format = GV_FORMAT_NATIVE;
-
+    Map->format = map_format(Map);
+    
     if (Map->format != GV_FORMAT_OGR_DIRECT &&
         getenv("GRASS_VECTOR_PGFILE") == NULL) { /* GRASS_VECTOR_PGFILE defined by v.out.postgis */
         char *path;
@@ -1214,7 +1211,7 @@
     
     format = GV_FORMAT_NATIVE;
     /* temporary maps can be stored only in native format */
-    if (Map->temporary)
+    if (Map->temporary || getenv("GRASS_VECTOR_EXTERNAL_IGNORE"))
         return format;
     
     if (G_find_file2("", "OGR", G_mapset())) {

Modified: grass/trunk/vector/v.external/main.c
===================================================================
--- grass/trunk/vector/v.external/main.c	2013-05-29 12:48:06 UTC (rev 56475)
+++ grass/trunk/vector/v.external/main.c	2013-05-29 13:46:17 UTC (rev 56476)
@@ -142,6 +142,7 @@
     }
     
     /* create new vector map */
+    putenv("GRASS_VECTOR_EXTERNAL_IGNORE=1");
     Vect_open_new(&Map, output, WITHOUT_Z); /* dimension is set later from data source */
     Vect_set_error_handler_io(NULL, &Map);
     



More information about the grass-commit mailing list