Explorar el Código

fix get_value function for point outside region

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@53988 15284696-431f-4ddb-bdfa-cd5b030d7da7
Luca Delucchi hace 12 años
padre
commit
d3c3ed5dbd
Se han modificado 1 ficheros con 2 adiciones y 0 borrados
  1. 2 0
      lib/python/pygrass/raster/abstract.py

+ 2 - 0
lib/python/pygrass/raster/abstract.py

@@ -293,6 +293,8 @@ class RasterAbstractBase(object):
         if not region:
             region = Region()
         x, y = functions.coor2pixel(point.coords(), region)
+        if x < 0 or x > region.cols or y < 0 or y > region.rows:
+            return None
         line = self.get_row(int(x))
         return line[int(y)]