mirror of
https://git.osgeo.org/gitea/postgis/postgis
synced 2024-10-24 00:52:40 +00:00
Updated tests for 'dog-ate-my-homework' test. Expanded comments and elaborated on complex conditionals in ST_MapAlgebraFctNgb
git-svn-id: http://svn.osgeo.org/postgis/trunk@8261 b70326c6-7e19-0410-871a-916f4a2858ee
This commit is contained in:
parent
6582cf9f06
commit
3b770bde14
|
@ -9558,7 +9558,8 @@ Datum RASTER_mapAlgebraFctNgb(PG_FUNCTION_ARGS)
|
|||
/* Replace the NODATA value with the currently processing pixel. */
|
||||
neighborData[nIndex] = Float8GetDatum((double)rpix);
|
||||
neighborNulls[nIndex] = false;
|
||||
/* do not increment nNullItems */
|
||||
/* do not increment nNullItems, since the user requested that the */
|
||||
/* neighborhood replace NODATA values with the central pixel value */
|
||||
}
|
||||
else {
|
||||
neighborData[nIndex] = PointerGetDatum(NULL);
|
||||
|
@ -9582,7 +9583,9 @@ Datum RASTER_mapAlgebraFctNgb(PG_FUNCTION_ARGS)
|
|||
* We compute a value only for the withdata value neighborhood since the
|
||||
* nodata value has already been set by the first optimization
|
||||
**/
|
||||
if (!nNodataOnly && !(nNullSkip && nNullItems > 0) && !(valuereplace && nNullItems > 0)) {
|
||||
if (!(nNodataOnly || /* neighborhood only contains NODATA -- OR -- */
|
||||
(nNullSkip && nNullItems > 0) || /* neighborhood should skip any NODATA cells, and a NODATA cell was detected -- OR -- */
|
||||
(valuereplace && nNullItems > 0))) { /* neighborhood should replace NODATA cells with the central pixel value, and a NODATA cell was detected */
|
||||
POSTGIS_RT_DEBUGF(3, "RASTER_mapAlgebraFctNgb: (%dx%d), %dx%d neighborhood",
|
||||
x, y, winwidth, winheight);
|
||||
|
||||
|
|
|
@ -222,3 +222,12 @@ SELECT
|
|||
ST_MapAlgebraFctNgb(rast, 1, NULL, 1, 1, 'ST_Nullage(float[][], text, text[])'::regprocedure, 'NULL', NULL), 2, 2
|
||||
) IS NULL
|
||||
FROM ST_TestRasterNgb(3, 3, 2) AS rast;
|
||||
|
||||
-- 'dog ate my homework' test
|
||||
-- raster initialized to one NODATA value, then a literal value passed in as the 'nodatamode' parameter.
|
||||
-- expect that the cells processed by the neighborhoods would be replaced by the 'nodatamode' parameter value, and not NODATA.
|
||||
SELECT
|
||||
ST_Value(
|
||||
ST_MapAlgebraFctNgb(rast, 1, '8BUI', 1, 1, 'ST_Sum(float[][], text, text[])'::regprocedure, '120', NULL), 2, 2
|
||||
) = 200
|
||||
FROM ST_SetValue(ST_SetBandNoDataValue(ST_TestRasterNgb(3, 3, 10), 0), 2, 2, 0) AS rast;
|
||||
|
|
|
@ -63,3 +63,4 @@ NOTICE: SRID value -1 converted to the officially unknown SRID value 0
|
|||
NOTICE: SRID value -1 converted to the officially unknown SRID value 0
|
||||
t|t|t
|
||||
t|t
|
||||
t
|
||||
|
|
Loading…
Reference in a new issue