[GRASS-SVN] r66893 - grass/branches/releasebranch_7_0/scripts/db.in.ogr

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Nov 22 09:48:00 PST 2015


Author: martinl
Date: 2015-11-22 09:48:00 -0800 (Sun, 22 Nov 2015)
New Revision: 66893

Modified:
   grass/branches/releasebranch_7_0/scripts/db.in.ogr/db.in.ogr.py
Log:
db.in.ogr: add encoding option (useful for DBF tables) [news]
           (merge r66892 from trunk)


Modified: grass/branches/releasebranch_7_0/scripts/db.in.ogr/db.in.ogr.py
===================================================================
--- grass/branches/releasebranch_7_0/scripts/db.in.ogr/db.in.ogr.py	2015-11-22 17:43:04 UTC (rev 66892)
+++ grass/branches/releasebranch_7_0/scripts/db.in.ogr/db.in.ogr.py	2015-11-22 17:48:00 UTC (rev 66893)
@@ -50,6 +50,14 @@
 #% guisection: Output
 #%end
 
+#%option
+#% key: encoding
+#% type: string
+#% label: Encoding value for attribute data
+#% descriptions: Overrides encoding interpretation, useful when importing DBF tables
+#% guisection: Output
+#%end
+
 import os
 import grass.script as grass
 from grass.exceptions import CalledModuleError
@@ -93,9 +101,13 @@
     else:
 	layer = None
 
+    vopts = {}
+    if options['encoding']:
+        vopts['encoding'] = options['encoding']
+    
     try:
         grass.run_command('v.in.ogr', flags='o', input=input, output=output,
-                          layer=layer, quiet=True)
+                          layer=layer, quiet=True, **vopts)
     except CalledModuleError:
         if db_table:
             grass.fatal(_("Input table <%s> not found or not readable") % input)



More information about the grass-commit mailing list