Переглянути джерело

v.import: add -o flag

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@67632 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 9 роки тому
батько
коміт
c5e12b0b61
1 змінених файлів з 12 додано та 5 видалено
  1. 12 5
      scripts/v.import/v.import.py

+ 12 - 5
scripts/v.import/v.import.py

@@ -91,7 +91,11 @@
 #% key: l
 #% description: List available OGR layers in data source and exit
 #%end
-
+#%flag
+#% key: o
+#% label: Override projection check (use current location's projection)
+#% description: Assume that the dataset has same projection as the current location
+#%end
 
 import sys
 import os
@@ -134,9 +138,12 @@ def main():
     output = options['output']
     layers = options['layer']
 
-    vflags = None
+    vflags = ''
     if options['extent'] == 'region':
-        vflags = 'r'
+        vflags += 'r'
+    if flags['o']:
+        vflags += 'o'
+
     vopts = {}
     if options['encoding']:
         vopts['encoding'] = options['encoding']
@@ -193,8 +200,8 @@ def main():
     os.environ['GISRC'] = str(tgtgisrc)
 
     # try v.in.ogr directly
-    if grass.run_command('v.in.ogr', input=OGRdatasource, flags='j',
-                         errors='status', quiet=True) == 0:
+    if flags['o'] or grass.run_command('v.in.ogr', input=OGRdatasource, flags='j',
+                                       errors='status', quiet=True) == 0:
         try:
             grass.run_command('v.in.ogr', input=OGRdatasource,
                               flags=vflags, **vopts)