[GRASS-SVN] r67672 - grass/trunk/lib/python/pygrass/raster

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Jan 26 00:18:38 PST 2016


Author: huhabla
Date: 2016-01-26 00:18:38 -0800 (Tue, 26 Jan 2016)
New Revision: 67672

Modified:
   grass/trunk/lib/python/pygrass/raster/abstract.py
Log:
pygrass raster: Improved version of get_value


Modified: grass/trunk/lib/python/pygrass/raster/abstract.py
===================================================================
--- grass/trunk/lib/python/pygrass/raster/abstract.py	2016-01-25 22:38:02 UTC (rev 67671)
+++ grass/trunk/lib/python/pygrass/raster/abstract.py	2016-01-26 08:18:38 UTC (rev 67672)
@@ -472,11 +472,15 @@
     def get_value(self, point, region=None):
         """This method returns the pixel value of a given pair of coordinates:
 
-        :param point: pair of coordinates in tuple object
+        :param point: pair of coordinates in tuple object or class object with coords() method
         """
+        # Check for tuple
+        if type(point) != type([]) and type(point) != type(()):
+            point = point.coords()
+
         if not region:
             region = Region()
-        row, col = utils.coor2pixel(point.coords(), region)
+        row, col = utils.coor2pixel(point, region)
         if col < 0 or col > region.cols or row < 0 or row > region.rows:
             return None
         line = self.get_row(int(row))



More information about the grass-commit mailing list