[GRASS-SVN] r51770 - grass/branches/develbranch_6/lib/python

svn_grass at osgeo.org svn_grass at osgeo.org
Sat May 26 07:20:48 EDT 2012


Author: annakrat
Date: 2012-05-26 04:20:48 -0700 (Sat, 26 May 2012)
New Revision: 51770

Modified:
   grass/branches/develbranch_6/lib/python/core.py
Log:
lib/python: locn_is_latlong function backported from trunk, r50816

Modified: grass/branches/develbranch_6/lib/python/core.py
===================================================================
--- grass/branches/develbranch_6/lib/python/core.py	2012-05-26 11:15:04 UTC (rev 51769)
+++ grass/branches/develbranch_6/lib/python/core.py	2012-05-26 11:20:48 UTC (rev 51770)
@@ -558,6 +558,19 @@
     s = read_command("g.gisenv", flags='n')
     return parse_key_val(s)
 
+def locn_is_latlong():
+    """!Tests if location is lat/long. Value is obtained
+    by checking the "g.region -p" projection code.
+
+    @return True for a lat/long region, False otherwise
+    """
+    s = read_command("g.region", flags='p')
+    kv = parse_key_val(s, ':')
+    if kv['projection'].split(' ')[1] == '3':
+        return True
+    else:
+        return False
+
 # interface to g.region
 
 def region(region3d = False):



More information about the grass-commit mailing list