[GRASS-SVN] r55589 - grass/trunk/scripts/db.out.ogr

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Apr 2 05:15:49 PDT 2013


Author: neteler
Date: 2013-04-02 05:15:49 -0700 (Tue, 02 Apr 2013)
New Revision: 55589

Modified:
   grass/trunk/scripts/db.out.ogr/db.out.ogr.html
   grass/trunk/scripts/db.out.ogr/db.out.ogr.py
Log:
db.out.ogr: also support attribute export in case of line and area vectors; support for multilayers

Modified: grass/trunk/scripts/db.out.ogr/db.out.ogr.html
===================================================================
--- grass/trunk/scripts/db.out.ogr/db.out.ogr.html	2013-04-02 12:01:35 UTC (rev 55588)
+++ grass/trunk/scripts/db.out.ogr/db.out.ogr.html	2013-04-02 12:15:49 UTC (rev 55589)
@@ -1,8 +1,15 @@
 <h2>DESCRIPTION</h2>
 
-<em>db.out.ogr</em> exports GRASS attribute tables into various formats as
+<em>db.out.ogr</em> exports GRASS GIS attribute tables into various formats as
 supported by the OGR driver on the local system (CSV, DBF,
 PostgreSQL, SQLite, MySQL, ODBC, etc.).
+<p>
+The <em>dsn</em> parameter is commonly the output file name (if the path is not
+defined, too, the module will attempt write to the current directory). In case
+of a database connection as output, the connection string has to be specified.
+<p>
+The <em>layer</em> parameter is needed if the attribute table to be exported
+is linked as non-default layer to a vector map.
 
 <h2>EXAMPLES</h2>
 

Modified: grass/trunk/scripts/db.out.ogr/db.out.ogr.py
===================================================================
--- grass/trunk/scripts/db.out.ogr/db.out.ogr.py	2013-04-02 12:01:35 UTC (rev 55588)
+++ grass/trunk/scripts/db.out.ogr/db.out.ogr.py	2013-04-02 12:15:49 UTC (rev 55589)
@@ -32,6 +32,10 @@
 #% required : yes
 #%end
 
+#%option G_OPT_V_FIELD
+#% required: no
+#%end
+
 #%option
 #% key: format
 #% type: string
@@ -55,6 +59,7 @@
 
 def main():
     input = options['input']
+    layer = options['layer']
     format = options['format']
     dsn = options['dsn']
     table = options['table']
@@ -73,12 +78,13 @@
 	grass.fatal(_("File <%s> already exists") % dbffile)
 
     if olayer:
-	if grass.run_command('v.out.ogr', quiet = True, input = input, dsn = dsn,
-			     format = format, type = 'point', olayer = olayer) != 0:
+	if grass.run_command('v.out.ogr', flags = 'c', quiet = True, input = input, layer = layer,
+			     dsn = dsn,
+			     format = format, type = 'point,line,area', olayer = olayer) != 0:
 	    sys.exit(1)
     else:
-	if grass.run_command('v.out.ogr', quiet = True, input = input, dsn = dsn,
-			     format = format, type = 'point') != 0:
+	if grass.run_command('v.out.ogr', flags = 'c', quiet = True, input = input, layer = layer,
+			     dsn = dsn, format = format, type = 'point,line,area') != 0:
 	    sys.exit(1)
 
     if format == "ESRI_Shapefile":



More information about the grass-commit mailing list