]> granicus.if.org Git - postgis/commitdiff
If hillshade < 0, hillshade = 0 for ST_HillShade()
authorBborie Park <bkpark at ucdavis.edu>
Fri, 16 Nov 2012 01:32:02 +0000 (01:32 +0000)
committerBborie Park <bkpark at ucdavis.edu>
Fri, 16 Nov 2012 01:32:02 +0000 (01:32 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@10689 b70326c6-7e19-0410-871a-916f4a2858ee

raster/rt_pg/rtpostgis.sql.in.c

index e611e8670ee7ed0028a3647b572ee5c7268f0883..41f9a36dfe2c07eb4ccea5693b0c7b7ff34048a7 100644 (file)
@@ -3795,6 +3795,11 @@ CREATE OR REPLACE FUNCTION _st_hillshade4ma(value double precision[][][], pos in
                END IF;
 
                shade := _bright * ((cos(zenith) * cos(slope)) + (sin(zenith) * sin(slope) * cos(azimuth - aspect)));
+
+               IF shade < 0. THEN
+                       shade := 0;
+               END IF;
+
                RETURN shade;
        END;
        $$ LANGUAGE 'plpgsql' IMMUTABLE;