From: Bborie Park Date: Mon, 29 Oct 2012 22:22:57 +0000 (+0000) Subject: Added check for SRID match in ST_Value(raster) geometry variant X-Git-Tag: 2.1.0beta2~443 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=bc1deba176160a8a583a3215ea5f7d981d1e60dd;p=postgis Added check for SRID match in ST_Value(raster) geometry variant git-svn-id: http://svn.osgeo.org/postgis/trunk@10583 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/raster/rt_pg/rtpostgis.sql.in.c b/raster/rt_pg/rtpostgis.sql.in.c index fa2b36730..caf54a190 100644 --- a/raster/rt_pg/rtpostgis.sql.in.c +++ b/raster/rt_pg/rtpostgis.sql.in.c @@ -3746,6 +3746,11 @@ CREATE OR REPLACE FUNCTION st_value(rast raster, band integer, pt geometry, excl IF ( gtype != 'ST_Point' ) THEN RAISE EXCEPTION 'Attempting to get the value of a pixel with a non-point geometry'; END IF; + + IF ST_SRID(pt) != ST_SRID(rast) THEN + RAISE EXCEPTION 'Raster and geometry do not have the same SRID'; + END IF; + x := st_x(pt); y := st_y(pt); RETURN st_value(rast, diff --git a/raster/test/regress/rt_pixelvalue_expected b/raster/test/regress/rt_pixelvalue_expected index b8e3ce5ef..4880f48f5 100644 --- a/raster/test/regress/rt_pixelvalue_expected +++ b/raster/test/regress/rt_pixelvalue_expected @@ -2,6 +2,8 @@ NOTICE: Attempting to get pixel value with out of range raster coordinates: (-2 NOTICE: Attempting to get pixel value with out of range raster coordinates: (-2, -2) NOTICE: Attempting to get pixel value with out of range raster coordinates: (-2, -2) NOTICE: Attempting to get pixel value with out of range raster coordinates: (-2, -2) +ERROR: Raster and geometry do not have the same SRID +ERROR: Raster and geometry do not have the same SRID NOTICE: Raster do not have a nodata value defined. Set band nodata value first. Nodata value not set. Returning original raster NOTICE: Raster do not have a nodata value defined. Set band nodata value first. Nodata value not set. Returning original raster NOTICE: Raster do not have a nodata value defined. Set band nodata value first. Nodata value not set. Returning original raster