[GRASS-SVN] r65690 - grass-addons/grass7/vector/v.import
svn_grass at osgeo.org
svn_grass at osgeo.org
Mon Jul 20 03:34:25 PDT 2015
Author: martinl
Date: 2015-07-20 03:34:25 -0700 (Mon, 20 Jul 2015)
New Revision: 65690
Modified:
grass-addons/grass7/vector/v.import/v.import.py
Log:
v.import: add -l/f flags
Modified: grass-addons/grass7/vector/v.import/v.import.py
===================================================================
--- grass-addons/grass7/vector/v.import/v.import.py 2015-07-20 10:32:36 UTC (rev 65689)
+++ grass-addons/grass7/vector/v.import/v.import.py 2015-07-20 10:34:25 UTC (rev 65690)
@@ -51,6 +51,15 @@
#% descriptions: input;extents of input map;region;extents of current region
#% guisection: Output
#%end
+#%flag
+#% key: f
+#% description: List supported OGR formats and exit
+#% suppress_required: yes
+#%end
+#%flag
+#% key: l
+#% description: List available OGR layers in data source and exit
+#%end
import sys
@@ -72,15 +81,25 @@
def main():
global tmploc, srcgisrc, gisdbase
- OGRdatasource = options['input']
- output = options['output']
- layers = options['layer']
-
# initialize global vars
tmploc = None
srcgisrc = None
gisdbase = None
+ # list formats and exit
+ if flags['f']:
+ grass.run_command('v.in.ogr', flags='f')
+ return 0
+
+ # list layers and exit
+ if flags['l']:
+ grass.run_command('v.in.ogr', flags='l', input=options['input'])
+ return 0
+
+ OGRdatasource = options['input']
+ output = options['output']
+ layers = options['layer']
+
vflags = None
if options['extents'] == 'region':
vflags = 'r'
More information about the grass-commit
mailing list