瀏覽代碼

r.import: Use temp region for resolution=value (#197)

Temp region was not used when g.region was called with resolution and -a.
Use same temp region settings as for extent=input.
Vaclav Petras 5 年之前
父節點
當前提交
fceba6902f
共有 1 個文件被更改,包括 4 次插入2 次删除
  1. 4 2
      scripts/r.import/r.import.py

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

@@ -351,8 +351,10 @@ def main():
         if flags['e']:
         if flags['e']:
             continue
             continue
 
 
-        if options['extent'] == 'input':
+        if options['extent'] == 'input' or tgtres == 'value':
             grass.use_temp_region()
             grass.use_temp_region()
+
+        if options['extent'] == 'input':
             grass.run_command('g.region', n=n, s=s, e=e, w=w)
             grass.run_command('g.region', n=n, s=s, e=e, w=w)
 
 
         res = None
         res = None
@@ -384,7 +386,7 @@ def main():
         if grass.raster_info(outfile)['min'] is None:
         if grass.raster_info(outfile)['min'] is None:
             grass.fatal(_("The reprojected raster <%s> is empty") % outfile)
             grass.fatal(_("The reprojected raster <%s> is empty") % outfile)
 
 
-        if options['extent'] == 'input':
+        if options['extent'] == 'input' or tgtres == 'value':
             grass.del_temp_region()
             grass.del_temp_region()
 
 
     if flags['e']:
     if flags['e']: