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

r.import: add r.in.gdal's -l flag

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@66483 15284696-431f-4ddb-bdfa-cd5b030d7da7
Anna Petrášová 9 роки тому
батько
коміт
0b1eac7b5a
2 змінених файлів з 10 додано та 2 видалено
  1. 3 0
      scripts/r.import/r.import.html
  2. 7 2
      scripts/r.import/r.import.py

+ 3 - 0
scripts/r.import/r.import.html

@@ -38,6 +38,9 @@ Both <b>bicubic</b> and <b>lanczos</b> preserve linear features. With
 <b>nearest</b> or <b>bilinear</b>, linear features can become zigzag 
 <b>nearest</b> or <b>bilinear</b>, linear features can become zigzag 
 features after reprojection.
 features after reprojection.
 
 
+<p>
+For explanation of <b>-l</b> flag, please refer to <a href="r.in.gdal.html">r.in.gdal</a> manual.
+
 <h2>KNOWN ISSUES</h2>
 <h2>KNOWN ISSUES</h2>
 Option <b>extent</b>=<em>region</em> works only when dataset has different
 Option <b>extent</b>=<em>region</em> works only when dataset has different
 projection than current location (<a href="r.proj.html">r.proj</a> is then used).
 projection than current location (<a href="r.proj.html">r.proj</a> is then used).

+ 7 - 2
scripts/r.import/r.import.py

@@ -102,6 +102,10 @@
 #% description: Do not perform region cropping optimization
 #% description: Do not perform region cropping optimization
 #% guisection: Optional
 #% guisection: Optional
 #%end
 #%end
+#%flag
+#% key: l
+#% description: Force Lat/Lon maps to fit into geographic coordinates (90N,S; 180E,W)
+#%end
 
 
 
 
 import sys
 import sys
@@ -186,10 +190,11 @@ def main():
     os.environ['GISRC'] = str(tgtgisrc)
     os.environ['GISRC'] = str(tgtgisrc)
 
 
     # try r.in.gdal directly first
     # try r.in.gdal directly first
+    additional_flags = 'l' if flags['l'] else ''
     if grass.run_command('r.in.gdal', input=GDALdatasource, flags='j',
     if grass.run_command('r.in.gdal', input=GDALdatasource, flags='j',
                          errors='status', quiet=True) == 0:
                          errors='status', quiet=True) == 0:
         parameters = dict(input=GDALdatasource, output=output,
         parameters = dict(input=GDALdatasource, output=output,
-                          memory=memory, flags='k')
+                          memory=memory, flags='k' + additional_flags)
         if bands:
         if bands:
             parameters['band'] = bands
             parameters['band'] = bands
         try:
         try:
@@ -213,7 +218,7 @@ def main():
     # import into temp location
     # import into temp location
     grass.verbose(_("Importing <%s> to temporary location...") % GDALdatasource)
     grass.verbose(_("Importing <%s> to temporary location...") % GDALdatasource)
     parameters = dict(input=GDALdatasource, output=output,
     parameters = dict(input=GDALdatasource, output=output,
-                      memory=memory, flags='k')
+                      memory=memory, flags='k' + additional_flags)
     if bands:
     if bands:
         parameters['band'] = bands
         parameters['band'] = bands
     try:
     try: