]> granicus.if.org Git - postgis/commitdiff
Tweaked rt_band_check_is_nodata() to make use of rt_band_get_pixel()'s
authorBborie Park <bkpark at ucdavis.edu>
Mon, 22 Oct 2012 17:19:41 +0000 (17:19 +0000)
committerBborie Park <bkpark at ucdavis.edu>
Mon, 22 Oct 2012 17:19:41 +0000 (17:19 +0000)
ability to return flag indicating if value is NODATA

git-svn-id: http://svn.osgeo.org/postgis/trunk@10515 b70326c6-7e19-0410-871a-916f4a2858ee

raster/rt_core/rt_api.c

index 1930bd80a449535889f442496b84baf9b8d34c67..6394ab8e57137ff9db80520242cf6a6317a9afaa 100644 (file)
@@ -2801,6 +2801,7 @@ int
 rt_band_check_is_nodata(rt_band band) {
        int i, j, err;
        double pxValue;
+       int isnodata = 0;
 
        assert(NULL != band);
 
@@ -2816,12 +2817,12 @@ rt_band_check_is_nodata(rt_band band) {
        /* Check all pixels */
        for (i = 0; i < band->width; i++) {
                for (j = 0; j < band->height; j++) {
-                       err = rt_band_get_pixel(band, i, j, &pxValue, NULL);
+                       err = rt_band_get_pixel(band, i, j, &pxValue, &isnodata);
                        if (err != 0) {
                                rterror("rt_band_check_is_nodata: Cannot get band pixel");
                                return FALSE;
                        }
-                       else if (FLT_NEQ(pxValue, band->nodataval)) {
+                       else if (!isnodata) {
                                band->isnodata = FALSE;
                                return FALSE;
                        }