[GRASS-SVN] r50816 - grass/trunk/lib/python
svn_grass at osgeo.org
svn_grass at osgeo.org
Wed Feb 15 03:30:44 EST 2012
Author: hamish
Date: 2012-02-15 00:30:44 -0800 (Wed, 15 Feb 2012)
New Revision: 50816
Modified:
grass/trunk/lib/python/core.py
Log:
fn which lets you know if it's a lat/long location or not, using a low-overhead method
Modified: grass/trunk/lib/python/core.py
===================================================================
--- grass/trunk/lib/python/core.py 2012-02-15 06:41:29 UTC (rev 50815)
+++ grass/trunk/lib/python/core.py 2012-02-15 08:30:44 UTC (rev 50816)
@@ -546,6 +546,19 @@
# interface to g.region
+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
+
def region():
"""!Returns the output from running "g.region -g", as a
dictionary. Example:
More information about the grass-commit
mailing list