[GRASS-SVN] r52012 - grass/trunk/vector/v.out.ascii

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Jun 8 08:18:32 PDT 2012


Author: martinl
Date: 2012-06-08 08:18:32 -0700 (Fri, 08 Jun 2012)
New Revision: 52012

Modified:
   grass/trunk/vector/v.out.ascii/main.c
Log:
v.out.ascii: require topo level for external formats (centroids are build from topo)


Modified: grass/trunk/vector/v.out.ascii/main.c
===================================================================
--- grass/trunk/vector/v.out.ascii/main.c	2012-06-08 13:58:30 UTC (rev 52011)
+++ grass/trunk/vector/v.out.ascii/main.c	2012-06-08 15:18:32 UTC (rev 52012)
@@ -70,8 +70,8 @@
     }
 
     /* open with topology only if needed */
-    if (format == GV_ASCII_FORMAT_WKT || (format == GV_ASCII_FORMAT_STD && 
-	(where || clist))) {
+    if (format == GV_ASCII_FORMAT_WKT ||
+        (format == GV_ASCII_FORMAT_STD && (where || clist))) {
 	if (Vect_open_old2(&Map, input, "", field_name) < 2) /* topology required for areas */
 	    G_warning(_("Unable to open vector map <%s> at topology level. "
 			"Areas will not be processed."),
@@ -81,8 +81,16 @@
 	Vect_set_open_level(1); /* topology not needed */ 
 	if (Vect_open_old2(&Map, input, "", field_name) < 0) 
 	    G_fatal_error(_("Unable to open vector map <%s>"), input); 
+        if (Vect_maptype(&Map) != GV_FORMAT_NATIVE) {
+            /* require topological level for external formats
+               centroids are read from topo */
+            Vect_close(&Map);
+            Vect_set_open_level(2);
+            if (Vect_open_old2(&Map, input, "", field_name) < 0) 
+                G_fatal_error(_("Unable to open vector map <%s>"), input); 
+        }
     }
-    
+
     field = Vect_get_field_number(&Map, field_name);
     
     if (strcmp(output, "-") != 0) {



More information about the grass-commit mailing list