[GRASS-SVN] r66298 - grass/trunk/scripts/r.import
svn_grass at osgeo.org
svn_grass at osgeo.org
Tue Sep 22 19:46:04 PDT 2015
Author: annakrat
Date: 2015-09-22 19:46:04 -0700 (Tue, 22 Sep 2015)
New Revision: 66298
Modified:
grass/trunk/scripts/r.import/r.import.py
Log:
r.import: fix import in latlon location
Modified: grass/trunk/scripts/r.import/r.import.py
===================================================================
--- grass/trunk/scripts/r.import/r.import.py 2015-09-22 22:24:10 UTC (rev 66297)
+++ grass/trunk/scripts/r.import/r.import.py 2015-09-23 02:46:04 UTC (rev 66298)
@@ -254,13 +254,23 @@
memory=memory, quiet=True)
except CalledModuleError:
grass.fatal(_("Unable to get reprojected map extent"))
+ try:
+ srcregion = grass.parse_key_val(tgtextents, val_type=float, vsep=' ')
+ n = srcregion['n']
+ s = srcregion['s']
+ e = srcregion['e']
+ w = srcregion['w']
+ except ValueError: # import into latlong, expect 53:39:06.894826N
+ srcregion = grass.parse_key_val(tgtextents, vsep=' ')
+ n = grass.float_or_dms(srcregion['n'][:-1]) * \
+ (-1 if srcregion['n'][-1] == 'S' else 1)
+ s = grass.float_or_dms(srcregion['s'][:-1]) * \
+ (-1 if srcregion['s'][-1] == 'S' else 1)
+ e = grass.float_or_dms(srcregion['e'][:-1]) * \
+ (-1 if srcregion['e'][-1] == 'W' else 1)
+ w = grass.float_or_dms(srcregion['w'][:-1]) * \
+ (-1 if srcregion['w'][-1] == 'W' else 1)
- srcregion = grass.parse_key_val(tgtextents, val_type=float, vsep=' ')
- n = srcregion['n']
- s = srcregion['s']
- e = srcregion['e']
- w = srcregion['w']
-
grass.run_command('g.region', n=n, s=s, e=e, w=w)
# v.in.region in tgt
More information about the grass-commit
mailing list