From 81d92baf7d62216b1f947aa69f1f1839817907e6 Mon Sep 17 00:00:00 2001 From: Bborie Park Date: Fri, 16 Nov 2012 01:32:02 +0000 Subject: [PATCH] If hillshade < 0, hillshade = 0 for ST_HillShade() git-svn-id: http://svn.osgeo.org/postgis/trunk@10689 b70326c6-7e19-0410-871a-916f4a2858ee --- raster/rt_pg/rtpostgis.sql.in.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/raster/rt_pg/rtpostgis.sql.in.c b/raster/rt_pg/rtpostgis.sql.in.c index e611e8670..41f9a36df 100644 --- a/raster/rt_pg/rtpostgis.sql.in.c +++ b/raster/rt_pg/rtpostgis.sql.in.c @@ -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; -- 2.40.0