]> granicus.if.org Git - postgis/commitdiff
Added rt_raster_covers() and regression tests
authorBborie Park <bkpark at ucdavis.edu>
Mon, 23 Jul 2012 22:56:45 +0000 (22:56 +0000)
committerBborie Park <bkpark at ucdavis.edu>
Mon, 23 Jul 2012 22:56:45 +0000 (22:56 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@10103 b70326c6-7e19-0410-871a-916f4a2858ee

raster/rt_core/rt_api.c
raster/rt_core/rt_api.h
raster/test/core/testapi.c

index 0771cb0f7e816c135bf7aa7cc2fab9e2fb81363c..fdc03ef2708f757aec2684f419f4db92a3f84478 100644 (file)
@@ -11562,6 +11562,9 @@ int rt_raster_geos_spatial_relationship(
                case GSR_CONTAINSPROPERLY:
                        rtn = GEOSRelatePattern(geom1, geom2, "T**FF*FF*");
                        break;
+               case GSR_COVERS:
+                       rtn = GEOSRelatePattern(geom1, geom2, "******FF*");
+                       break;
                default:
                        rterror("rt_raster_geos_spatial_relationship: Unknown or unsupported GEOS spatial relationship test");
                        flag = -1;
@@ -11712,6 +11715,37 @@ int rt_raster_contains_properly(
        );
 }
 
+/**
+ * Return zero if error occurred in function.
+ * Parameter contains returns non-zero if rast1 covers rast2
+ *
+ * @param rast1 : the first raster whose band will be tested
+ * @param nband1 : the 0-based band of raster rast1 to use
+ *   if value is less than zero, bands are ignored.
+ *   if nband1 gte zero, nband2 must be gte zero
+ * @param rast2 : the second raster whose band will be tested
+ * @param nband2 : the 0-based band of raster rast2 to use
+ *   if value is less than zero, bands are ignored
+ *   if nband2 gte zero, nband1 must be gte zero
+ * @param touches : non-zero value if rast1 covers rast2
+ *
+ * @return if zero, an error occurred in function
+ */
+int rt_raster_covers(
+       rt_raster rast1, int nband1,
+       rt_raster rast2, int nband2,
+       int *covers
+) {
+       RASTER_DEBUG(3, "Starting");
+
+       return rt_raster_geos_spatial_relationship(
+               rast1, nband1,
+               rast2, nband2,
+               GSR_COVERS,
+               covers
+       );
+}
+
 /*
  * Return zero if error occurred in function.
  * Paramter aligned returns non-zero if two rasters are aligned
index ba9858be4d9a7266ba8d1a43eff5687e2cca7003..e84c40913c310297b7987bf8f285e4766eef0bc9 100644 (file)
@@ -179,11 +179,15 @@ typedef enum {
        ET_SECOND
 } rt_extenttype;
 
+/**
+ * GEOS spatial relationship tests available
+ */
 typedef enum {
        GSR_OVERLAPS = 0,
        GSR_TOUCHES,
        GSR_CONTAINS,
        GSR_CONTAINSPROPERLY,
+       GSR_COVERS
 } rt_geos_spatial_test;
 
 /**
@@ -1545,6 +1549,28 @@ int rt_raster_touches(
        int *touches
 );
 
+/**
+ * Return zero if error occurred in function.
+ * Parameter contains returns non-zero if rast1 covers rast2
+ *
+ * @param rast1 : the first raster whose band will be tested
+ * @param nband1 : the 0-based band of raster rast1 to use
+ *   if value is less than zero, bands are ignored.
+ *   if nband1 gte zero, nband2 must be gte zero
+ * @param rast2 : the second raster whose band will be tested
+ * @param nband2 : the 0-based band of raster rast2 to use
+ *   if value is less than zero, bands are ignored
+ *   if nband2 gte zero, nband1 must be gte zero
+ * @param touches : non-zero value if rast1 covers rast2
+ *
+ * @return if zero, an error occurred in function
+ */
+int rt_raster_covers(
+       rt_raster rast1, int nband1,
+       rt_raster rast2, int nband2,
+       int *covers
+);
+
 /*
  * Return zero if error occurred in function.
  * Paramter aligned returns non-zero if two rasters are aligned
index 54a2d5a57db534d049dc24a10295e3eeb9a40ad4..6b3eb6a6fd81050acab514ea9abc72e709f209a4 100644 (file)
@@ -1919,7 +1919,7 @@ static void testIntersects() {
        rt_band band2;
        double nodata;
        int rtn;
-       int intersects;
+       int result;
 
        /*
                rast1
@@ -1975,18 +1975,18 @@ static void testIntersects() {
        rtn = rt_raster_intersects(
                rast1, 0,
                rast2, 0,
-               &intersects
+               &result
        );
        CHECK((rtn != 0));
-       CHECK((intersects == 1));
+       CHECK((result == 1));
 
        rtn = rt_raster_intersects(
                rast1, -1,
                rast2, -1,
-               &intersects
+               &result
        );
        CHECK((rtn != 0));
-       CHECK((intersects == 1));
+       CHECK((result == 1));
 
        /*
                rast2
@@ -2004,10 +2004,10 @@ static void testIntersects() {
        rtn = rt_raster_intersects(
                rast1, 0,
                rast2, 0,
-               &intersects
+               &result
        );
        CHECK((rtn != 0));
-       CHECK((intersects == 1));
+       CHECK((result == 1));
 
        /*
                rast2
@@ -2026,10 +2026,10 @@ static void testIntersects() {
        rtn = rt_raster_intersects(
                rast1, 0,
                rast2, 0,
-               &intersects
+               &result
        );
        CHECK((rtn != 0));
-       CHECK((intersects == 1));
+       CHECK((result == 1));
 
        /*
                rast2
@@ -2049,10 +2049,10 @@ static void testIntersects() {
        rtn = rt_raster_intersects(
                rast1, 0,
                rast2, 0,
-               &intersects
+               &result
        );
        CHECK((rtn != 0));
-       CHECK((intersects == 1));
+       CHECK((result == 1));
 
        /*
                rast2
@@ -2073,10 +2073,10 @@ static void testIntersects() {
        rtn = rt_raster_intersects(
                rast1, 0,
                rast2, 0,
-               &intersects
+               &result
        );
        CHECK((rtn != 0));
-       CHECK((intersects != 1));
+       CHECK((result != 1));
 
        /*
                rast2
@@ -2099,10 +2099,10 @@ static void testIntersects() {
        rtn = rt_raster_intersects(
                rast1, 0,
                rast2, 0,
-               &intersects
+               &result
        );
        CHECK((rtn != 0));
-       CHECK((intersects != 1));
+       CHECK((result != 1));
 
        /*
                rast2
@@ -2126,10 +2126,10 @@ static void testIntersects() {
        rtn = rt_raster_intersects(
                rast1, 0,
                rast2, 0,
-               &intersects
+               &result
        );
        CHECK((rtn != 0));
-       CHECK((intersects == 1));
+       CHECK((result == 1));
 
        /*
                rast2
@@ -2147,10 +2147,10 @@ static void testIntersects() {
        rtn = rt_raster_intersects(
                rast1, 0,
                rast2, 0,
-               &intersects
+               &result
        );
        CHECK((rtn != 0));
-       CHECK((intersects == 1));
+       CHECK((result == 1));
 
        deepRelease(rast2);
 
@@ -2189,10 +2189,10 @@ static void testIntersects() {
        rtn = rt_raster_intersects(
                rast1, 0,
                rast2, 0,
-               &intersects
+               &result
        );
        CHECK((rtn != 0));
-       CHECK((intersects == 1));
+       CHECK((result == 1));
 
        /*
                rast2
@@ -2222,10 +2222,10 @@ static void testIntersects() {
        rtn = rt_raster_intersects(
                rast1, 0,
                rast2, 0,
-               &intersects
+               &result
        );
        CHECK((rtn != 0));
-       CHECK((intersects == 1));
+       CHECK((result == 1));
 
        /*
                rast2
@@ -2253,10 +2253,10 @@ static void testIntersects() {
        rtn = rt_raster_intersects(
                rast1, 0,
                rast2, 0,
-               &intersects
+               &result
        );
        CHECK((rtn != 0));
-       CHECK((intersects == 1));
+       CHECK((result == 1));
 
        /*
                rast2
@@ -2284,10 +2284,10 @@ static void testIntersects() {
        rtn = rt_raster_intersects(
                rast1, 0,
                rast2, 0,
-               &intersects
+               &result
        );
        CHECK((rtn != 0));
-       CHECK((intersects == 1));
+       CHECK((result == 1));
 
        /*
                rast2
@@ -2315,10 +2315,10 @@ static void testIntersects() {
        rtn = rt_raster_intersects(
                rast1, 0,
                rast2, 0,
-               &intersects
+               &result
        );
        CHECK((rtn != 0));
-       CHECK((intersects == 1));
+       CHECK((result == 1));
 
        deepRelease(rast2);
 
@@ -2344,10 +2344,10 @@ static void testIntersects() {
        rtn = rt_raster_intersects(
                rast1, 0,
                rast2, 0,
-               &intersects
+               &result
        );
        CHECK((rtn != 0));
-       CHECK((intersects == 1));
+       CHECK((result == 1));
 
        /* rast2 (skewed by -1, 1) */
        rt_raster_set_skews(rast2, -1, 1);
@@ -2355,10 +2355,10 @@ static void testIntersects() {
        rtn = rt_raster_intersects(
                rast1, 0,
                rast2, 0,
-               &intersects
+               &result
        );
        CHECK((rtn != 0));
-       CHECK((intersects == 1));
+       CHECK((result == 1));
 
        /* rast2 (skewed by 1, -1) */
        rt_raster_set_skews(rast2, 1, -1);
@@ -2366,10 +2366,10 @@ static void testIntersects() {
        rtn = rt_raster_intersects(
                rast1, 0,
                rast2, 0,
-               &intersects
+               &result
        );
        CHECK((rtn != 0));
-       CHECK((intersects == 1));
+       CHECK((result == 1));
 
        deepRelease(rast2);
        deepRelease(rast1);
@@ -2382,7 +2382,7 @@ static void testOverlaps() {
        rt_band band2;
        double nodata;
        int rtn;
-       int overlaps;
+       int result;
 
        /*
                rast1
@@ -2413,10 +2413,10 @@ static void testOverlaps() {
        rtn = rt_raster_overlaps(
                rast1, 0,
                rast1, 0,
-               &overlaps
+               &result
        );
        CHECK((rtn != 0));
-       CHECK((overlaps != 1));
+       CHECK((result != 1));
 
        /*
                rast2
@@ -2446,18 +2446,18 @@ static void testOverlaps() {
        rtn = rt_raster_overlaps(
                rast1, 0,
                rast2, 0,
-               &overlaps
+               &result
        );
        CHECK((rtn != 0));
-       CHECK((overlaps == 1));
+       CHECK((result == 1));
 
        rtn = rt_raster_overlaps(
                rast1, -1,
                rast2, -1,
-               &overlaps
+               &result
        );
        CHECK((rtn != 0));
-       CHECK((overlaps == 1));
+       CHECK((result == 1));
 
        /*
                rast2
@@ -2475,10 +2475,10 @@ static void testOverlaps() {
        rtn = rt_raster_overlaps(
                rast1, 0,
                rast2, 0,
-               &overlaps
+               &result
        );
        CHECK((rtn != 0));
-       CHECK((overlaps != 1));
+       CHECK((result != 1));
 
        /*
                rast2
@@ -2497,10 +2497,10 @@ static void testOverlaps() {
        rtn = rt_raster_overlaps(
                rast1, 0,
                rast2, 0,
-               &overlaps
+               &result
        );
        CHECK((rtn != 0));
-       CHECK((overlaps == 1));
+       CHECK((result == 1));
 
        /*
                rast2
@@ -2520,10 +2520,10 @@ static void testOverlaps() {
        rtn = rt_raster_overlaps(
                rast1, 0,
                rast2, 0,
-               &overlaps
+               &result
        );
        CHECK((rtn != 0));
-       CHECK((overlaps != 1));
+       CHECK((result != 1));
 
        /*
                rast2
@@ -2544,10 +2544,10 @@ static void testOverlaps() {
        rtn = rt_raster_overlaps(
                rast1, 0,
                rast2, 0,
-               &overlaps
+               &result
        );
        CHECK((rtn != 0));
-       CHECK((overlaps != 1));
+       CHECK((result != 1));
 
        /*
                rast2
@@ -2570,10 +2570,10 @@ static void testOverlaps() {
        rtn = rt_raster_overlaps(
                rast1, 0,
                rast2, 0,
-               &overlaps
+               &result
        );
        CHECK((rtn != 0));
-       CHECK((overlaps != 1));
+       CHECK((result != 1));
 
        /*
                rast2
@@ -2597,10 +2597,10 @@ static void testOverlaps() {
        rtn = rt_raster_overlaps(
                rast1, 0,
                rast2, 0,
-               &overlaps
+               &result
        );
        CHECK((rtn != 0));
-       CHECK((overlaps != 1));
+       CHECK((result != 1));
 
        /*
                rast2
@@ -2618,10 +2618,10 @@ static void testOverlaps() {
        rtn = rt_raster_overlaps(
                rast1, 0,
                rast2, 0,
-               &overlaps
+               &result
        );
        CHECK((rtn != 0));
-       CHECK((overlaps != 1));
+       CHECK((result != 1));
 
        deepRelease(rast2);
 
@@ -2660,10 +2660,10 @@ static void testOverlaps() {
        rtn = rt_raster_overlaps(
                rast1, 0,
                rast2, 0,
-               &overlaps
+               &result
        );
        CHECK((rtn != 0));
-       CHECK((overlaps == 1));
+       CHECK((result == 1));
 
        /*
                rast2
@@ -2693,10 +2693,10 @@ static void testOverlaps() {
        rtn = rt_raster_overlaps(
                rast1, 0,
                rast2, 0,
-               &overlaps
+               &result
        );
        CHECK((rtn != 0));
-       CHECK((overlaps != 1));
+       CHECK((result != 1));
 
        /*
                rast2
@@ -2724,10 +2724,10 @@ static void testOverlaps() {
        rtn = rt_raster_overlaps(
                rast1, 0,
                rast2, 0,
-               &overlaps
+               &result
        );
        CHECK((rtn != 0));
-       CHECK((overlaps == 1));
+       CHECK((result == 1));
 
        /*
                rast2
@@ -2755,10 +2755,10 @@ static void testOverlaps() {
        rtn = rt_raster_overlaps(
                rast1, 0,
                rast2, 0,
-               &overlaps
+               &result
        );
        CHECK((rtn != 0));
-       CHECK((overlaps != 1));
+       CHECK((result != 1));
 
        /*
                rast2
@@ -2786,10 +2786,10 @@ static void testOverlaps() {
        rtn = rt_raster_overlaps(
                rast1, 0,
                rast2, 0,
-               &overlaps
+               &result
        );
        CHECK((rtn != 0));
-       CHECK((overlaps != 1));
+       CHECK((result != 1));
 
        deepRelease(rast2);
 
@@ -2815,10 +2815,10 @@ static void testOverlaps() {
        rtn = rt_raster_overlaps(
                rast1, 0,
                rast2, 0,
-               &overlaps
+               &result
        );
        CHECK((rtn != 0));
-       CHECK((overlaps == 1));
+       CHECK((result == 1));
 
        /* rast2 (skewed by -1, 1) */
        rt_raster_set_skews(rast2, -1, 1);
@@ -2826,10 +2826,10 @@ static void testOverlaps() {
        rtn = rt_raster_overlaps(
                rast1, 0,
                rast2, 0,
-               &overlaps
+               &result
        );
        CHECK((rtn != 0));
-       CHECK((overlaps == 1));
+       CHECK((result == 1));
 
        /* rast2 (skewed by 1, -1) */
        rt_raster_set_skews(rast2, 1, -1);
@@ -2837,10 +2837,10 @@ static void testOverlaps() {
        rtn = rt_raster_overlaps(
                rast1, 0,
                rast2, 0,
-               &overlaps
+               &result
        );
        CHECK((rtn != 0));
-       CHECK((overlaps == 1));
+       CHECK((result == 1));
 
        deepRelease(rast2);
        deepRelease(rast1);
@@ -2853,7 +2853,7 @@ static void testTouches() {
        rt_band band2;
        double nodata;
        int rtn;
-       int touches;
+       int result;
 
        /*
                rast1
@@ -2884,10 +2884,10 @@ static void testTouches() {
        rtn = rt_raster_touches(
                rast1, 0,
                rast1, 0,
-               &touches
+               &result
        );
        CHECK((rtn != 0));
-       CHECK((touches != 1));
+       CHECK((result != 1));
 
        /*
                rast2
@@ -2917,18 +2917,18 @@ static void testTouches() {
        rtn = rt_raster_touches(
                rast1, 0,
                rast2, 0,
-               &touches
+               &result
        );
        CHECK((rtn != 0));
-       CHECK((touches != 1));
+       CHECK((result != 1));
 
        rtn = rt_raster_touches(
                rast1, -1,
                rast2, -1,
-               &touches
+               &result
        );
        CHECK((rtn != 0));
-       CHECK((touches != 1));
+       CHECK((result != 1));
 
        /*
                rast2
@@ -2946,10 +2946,10 @@ static void testTouches() {
        rtn = rt_raster_touches(
                rast1, 0,
                rast2, 0,
-               &touches
+               &result
        );
        CHECK((rtn != 0));
-       CHECK((touches == 1));
+       CHECK((result == 1));
 
        /*
                rast2
@@ -2968,10 +2968,10 @@ static void testTouches() {
        rtn = rt_raster_touches(
                rast1, 0,
                rast2, 0,
-               &touches
+               &result
        );
        CHECK((rtn != 0));
-       CHECK((touches != 1));
+       CHECK((result != 1));
 
        /*
                rast2
@@ -2991,10 +2991,10 @@ static void testTouches() {
        rtn = rt_raster_touches(
                rast1, 0,
                rast2, 0,
-               &touches
+               &result
        );
        CHECK((rtn != 0));
-       CHECK((touches == 1));
+       CHECK((result == 1));
 
        /*
                rast2
@@ -3015,10 +3015,10 @@ static void testTouches() {
        rtn = rt_raster_touches(
                rast1, 0,
                rast2, 0,
-               &touches
+               &result
        );
        CHECK((rtn != 0));
-       CHECK((touches != 1));
+       CHECK((result != 1));
 
        /*
                rast2
@@ -3041,10 +3041,10 @@ static void testTouches() {
        rtn = rt_raster_touches(
                rast1, 0,
                rast2, 0,
-               &touches
+               &result
        );
        CHECK((rtn != 0));
-       CHECK((touches != 1));
+       CHECK((result != 1));
 
        /*
                rast2
@@ -3067,10 +3067,10 @@ static void testTouches() {
        rtn = rt_raster_touches(
                rast1, 0,
                rast2, 0,
-               &touches
+               &result
        );
        CHECK((rtn != 0));
-       CHECK((touches == 1));
+       CHECK((result == 1));
 
        /*
                rast2
@@ -3093,10 +3093,10 @@ static void testTouches() {
        rtn = rt_raster_touches(
                rast1, 0,
                rast2, 0,
-               &touches
+               &result
        );
        CHECK((rtn != 0));
-       CHECK((touches == 1));
+       CHECK((result == 1));
 
        /*
                rast2
@@ -3120,10 +3120,10 @@ static void testTouches() {
        rtn = rt_raster_touches(
                rast1, 0,
                rast2, 0,
-               &touches
+               &result
        );
        CHECK((rtn != 0));
-       CHECK((touches != 1));
+       CHECK((result != 1));
 
        /*
                rast2
@@ -3141,10 +3141,10 @@ static void testTouches() {
        rtn = rt_raster_touches(
                rast1, 0,
                rast2, 0,
-               &touches
+               &result
        );
        CHECK((rtn != 0));
-       CHECK((touches != 1));
+       CHECK((result != 1));
 
        deepRelease(rast2);
 
@@ -3183,10 +3183,10 @@ static void testTouches() {
        rtn = rt_raster_touches(
                rast1, 0,
                rast2, 0,
-               &touches
+               &result
        );
        CHECK((rtn != 0));
-       CHECK((touches != 1));
+       CHECK((result != 1));
 
        /*
                rast2
@@ -3216,10 +3216,10 @@ static void testTouches() {
        rtn = rt_raster_touches(
                rast1, 0,
                rast2, 0,
-               &touches
+               &result
        );
        CHECK((rtn != 0));
-       CHECK((touches != 1));
+       CHECK((result != 1));
 
        /*
                rast2
@@ -3247,10 +3247,10 @@ static void testTouches() {
        rtn = rt_raster_touches(
                rast1, 0,
                rast2, 0,
-               &touches
+               &result
        );
        CHECK((rtn != 0));
-       CHECK((touches != 1));
+       CHECK((result != 1));
 
        /*
                rast2
@@ -3278,10 +3278,10 @@ static void testTouches() {
        rtn = rt_raster_touches(
                rast1, 0,
                rast2, 0,
-               &touches
+               &result
        );
        CHECK((rtn != 0));
-       CHECK((touches == 1));
+       CHECK((result == 1));
 
        /*
                rast2
@@ -3309,10 +3309,10 @@ static void testTouches() {
        rtn = rt_raster_touches(
                rast1, 0,
                rast2, 0,
-               &touches
+               &result
        );
        CHECK((rtn != 0));
-       CHECK((touches == 1));
+       CHECK((result == 1));
 
        deepRelease(rast2);
 
@@ -3338,10 +3338,10 @@ static void testTouches() {
        rtn = rt_raster_touches(
                rast1, 0,
                rast2, 0,
-               &touches
+               &result
        );
        CHECK((rtn != 0));
-       CHECK((touches != 1));
+       CHECK((result != 1));
 
        /* rast2 (skewed by -1, 1) */
        rt_raster_set_skews(rast2, -1, 1);
@@ -3349,10 +3349,10 @@ static void testTouches() {
        rtn = rt_raster_touches(
                rast1, 0,
                rast2, 0,
-               &touches
+               &result
        );
        CHECK((rtn != 0));
-       CHECK((touches != 1));
+       CHECK((result != 1));
 
        /* rast2 (skewed by 1, -1) */
        rt_raster_set_skews(rast2, 1, -1);
@@ -3360,10 +3360,10 @@ static void testTouches() {
        rtn = rt_raster_touches(
                rast1, 0,
                rast2, 0,
-               &touches
+               &result
        );
        CHECK((rtn != 0));
-       CHECK((touches != 1));
+       CHECK((result != 1));
 
        deepRelease(rast2);
        deepRelease(rast1);
@@ -3376,7 +3376,7 @@ static void testContains() {
        rt_band band2;
        double nodata;
        int rtn;
-       int contains;
+       int result;
 
        /*
                rast1
@@ -3407,10 +3407,10 @@ static void testContains() {
        rtn = rt_raster_contains(
                rast1, 0,
                rast1, 0,
-               &contains
+               &result
        );
        CHECK((rtn != 0));
-       CHECK((contains == 1));
+       CHECK((result == 1));
 
        /*
                rast2
@@ -3440,18 +3440,18 @@ static void testContains() {
        rtn = rt_raster_contains(
                rast1, 0,
                rast2, 0,
-               &contains
+               &result
        );
        CHECK((rtn != 0));
-       CHECK((contains != 1));
+       CHECK((result != 1));
 
        rtn = rt_raster_contains(
                rast1, -1,
                rast2, -1,
-               &contains
+               &result
        );
        CHECK((rtn != 0));
-       CHECK((contains != 1));
+       CHECK((result != 1));
 
        /*
                rast2
@@ -3469,10 +3469,10 @@ static void testContains() {
        rtn = rt_raster_contains(
                rast1, 0,
                rast2, 0,
-               &contains
+               &result
        );
        CHECK((rtn != 0));
-       CHECK((contains != 1));
+       CHECK((result != 1));
 
        /*
                rast2
@@ -3491,10 +3491,10 @@ static void testContains() {
        rtn = rt_raster_contains(
                rast1, 0,
                rast2, 0,
-               &contains
+               &result
        );
        CHECK((rtn != 0));
-       CHECK((contains != 1));
+       CHECK((result != 1));
 
        /*
                rast2
@@ -3514,10 +3514,10 @@ static void testContains() {
        rtn = rt_raster_contains(
                rast1, 0,
                rast2, 0,
-               &contains
+               &result
        );
        CHECK((rtn != 0));
-       CHECK((contains != 1));
+       CHECK((result != 1));
 
        /*
                rast2
@@ -3538,10 +3538,10 @@ static void testContains() {
        rtn = rt_raster_contains(
                rast1, 0,
                rast2, 0,
-               &contains
+               &result
        );
        CHECK((rtn != 0));
-       CHECK((contains != 1));
+       CHECK((result != 1));
 
        /*
                rast2
@@ -3564,10 +3564,10 @@ static void testContains() {
        rtn = rt_raster_contains(
                rast1, 0,
                rast2, 0,
-               &contains
+               &result
        );
        CHECK((rtn != 0));
-       CHECK((contains != 1));
+       CHECK((result != 1));
 
        /*
                rast2
@@ -3590,10 +3590,10 @@ static void testContains() {
        rtn = rt_raster_contains(
                rast1, 0,
                rast2, 0,
-               &contains
+               &result
        );
        CHECK((rtn != 0));
-       CHECK((contains != 1));
+       CHECK((result != 1));
 
        /*
                rast2
@@ -3616,10 +3616,10 @@ static void testContains() {
        rtn = rt_raster_contains(
                rast1, 0,
                rast2, 0,
-               &contains
+               &result
        );
        CHECK((rtn != 0));
-       CHECK((contains != 1));
+       CHECK((result != 1));
 
        /*
                rast2
@@ -3643,10 +3643,10 @@ static void testContains() {
        rtn = rt_raster_contains(
                rast1, 0,
                rast2, 0,
-               &contains
+               &result
        );
        CHECK((rtn != 0));
-       CHECK((contains == 1));
+       CHECK((result == 1));
 
        /*
                rast2
@@ -3664,10 +3664,10 @@ static void testContains() {
        rtn = rt_raster_contains(
                rast1, 0,
                rast2, 0,
-               &contains
+               &result
        );
        CHECK((rtn != 0));
-       CHECK((contains == 1));
+       CHECK((result == 1));
 
        deepRelease(rast2);
 
@@ -3706,10 +3706,10 @@ static void testContains() {
        rtn = rt_raster_contains(
                rast1, 0,
                rast2, 0,
-               &contains
+               &result
        );
        CHECK((rtn != 0));
-       CHECK((contains != 1));
+       CHECK((result != 1));
 
        /*
                rast2
@@ -3739,10 +3739,10 @@ static void testContains() {
        rtn = rt_raster_contains(
                rast1, 0,
                rast2, 0,
-               &contains
+               &result
        );
        CHECK((rtn != 0));
-       CHECK((contains != 1));
+       CHECK((result != 1));
 
        /*
                rast2
@@ -3770,10 +3770,10 @@ static void testContains() {
        rtn = rt_raster_contains(
                rast1, 0,
                rast2, 0,
-               &contains
+               &result
        );
        CHECK((rtn != 0));
-       CHECK((contains != 1));
+       CHECK((result != 1));
 
        /*
                rast2
@@ -3801,10 +3801,10 @@ static void testContains() {
        rtn = rt_raster_contains(
                rast1, 0,
                rast2, 0,
-               &contains
+               &result
        );
        CHECK((rtn != 0));
-       CHECK((contains != 1));
+       CHECK((result != 1));
 
        /*
                rast2
@@ -3832,10 +3832,10 @@ static void testContains() {
        rtn = rt_raster_contains(
                rast1, 0,
                rast2, 0,
-               &contains
+               &result
        );
        CHECK((rtn != 0));
-       CHECK((contains != 1));
+       CHECK((result != 1));
 
        deepRelease(rast2);
 
@@ -3861,10 +3861,10 @@ static void testContains() {
        rtn = rt_raster_contains(
                rast1, 0,
                rast2, 0,
-               &contains
+               &result
        );
        CHECK((rtn != 0));
-       CHECK((contains != 1));
+       CHECK((result != 1));
 
        /* rast2 (skewed by -1, 1) */
        rt_raster_set_skews(rast2, -1, 1);
@@ -3872,10 +3872,10 @@ static void testContains() {
        rtn = rt_raster_contains(
                rast1, 0,
                rast2, 0,
-               &contains
+               &result
        );
        CHECK((rtn != 0));
-       CHECK((contains != 1));
+       CHECK((result != 1));
 
        /* rast2 (skewed by 1, -1) */
        rt_raster_set_skews(rast2, 1, -1);
@@ -3883,10 +3883,10 @@ static void testContains() {
        rtn = rt_raster_contains(
                rast1, 0,
                rast2, 0,
-               &contains
+               &result
        );
        CHECK((rtn != 0));
-       CHECK((contains != 1));
+       CHECK((result != 1));
 
        deepRelease(rast2);
        deepRelease(rast1);
@@ -3899,7 +3899,7 @@ static void testContainsProperly() {
        rt_band band2;
        double nodata;
        int rtn;
-       int contains;
+       int result;
 
        /*
                rast1
@@ -3930,10 +3930,10 @@ static void testContainsProperly() {
        rtn = rt_raster_contains_properly(
                rast1, 0,
                rast1, 0,
-               &contains
+               &result
        );
        CHECK((rtn != 0));
-       CHECK((contains != 1));
+       CHECK((result != 1));
 
        /*
                rast2
@@ -3963,18 +3963,18 @@ static void testContainsProperly() {
        rtn = rt_raster_contains_properly(
                rast1, 0,
                rast2, 0,
-               &contains
+               &result
        );
        CHECK((rtn != 0));
-       CHECK((contains != 1));
+       CHECK((result != 1));
 
        rtn = rt_raster_contains_properly(
                rast1, -1,
                rast2, -1,
-               &contains
+               &result
        );
        CHECK((rtn != 0));
-       CHECK((contains != 1));
+       CHECK((result != 1));
 
        /*
                rast2
@@ -3992,10 +3992,10 @@ static void testContainsProperly() {
        rtn = rt_raster_contains_properly(
                rast1, 0,
                rast2, 0,
-               &contains
+               &result
        );
        CHECK((rtn != 0));
-       CHECK((contains != 1));
+       CHECK((result != 1));
 
        /*
                rast2
@@ -4014,10 +4014,10 @@ static void testContainsProperly() {
        rtn = rt_raster_contains_properly(
                rast1, 0,
                rast2, 0,
-               &contains
+               &result
        );
        CHECK((rtn != 0));
-       CHECK((contains != 1));
+       CHECK((result != 1));
 
        /*
                rast2
@@ -4037,10 +4037,10 @@ static void testContainsProperly() {
        rtn = rt_raster_contains_properly(
                rast1, 0,
                rast2, 0,
-               &contains
+               &result
        );
        CHECK((rtn != 0));
-       CHECK((contains != 1));
+       CHECK((result != 1));
 
        /*
                rast2
@@ -4061,10 +4061,10 @@ static void testContainsProperly() {
        rtn = rt_raster_contains_properly(
                rast1, 0,
                rast2, 0,
-               &contains
+               &result
        );
        CHECK((rtn != 0));
-       CHECK((contains != 1));
+       CHECK((result != 1));
 
        /*
                rast2
@@ -4087,10 +4087,10 @@ static void testContainsProperly() {
        rtn = rt_raster_contains_properly(
                rast1, 0,
                rast2, 0,
-               &contains
+               &result
        );
        CHECK((rtn != 0));
-       CHECK((contains != 1));
+       CHECK((result != 1));
 
        /*
                rast2
@@ -4113,10 +4113,10 @@ static void testContainsProperly() {
        rtn = rt_raster_contains_properly(
                rast1, 0,
                rast2, 0,
-               &contains
+               &result
        );
        CHECK((rtn != 0));
-       CHECK((contains != 1));
+       CHECK((result != 1));
 
        /*
                rast2
@@ -4139,10 +4139,10 @@ static void testContainsProperly() {
        rtn = rt_raster_contains_properly(
                rast1, 0,
                rast2, 0,
-               &contains
+               &result
        );
        CHECK((rtn != 0));
-       CHECK((contains != 1));
+       CHECK((result != 1));
 
        /*
                rast2
@@ -4166,10 +4166,10 @@ static void testContainsProperly() {
        rtn = rt_raster_contains_properly(
                rast1, 0,
                rast2, 0,
-               &contains
+               &result
        );
        CHECK((rtn != 0));
-       CHECK((contains == 1));
+       CHECK((result == 1));
 
        /*
                rast2
@@ -4187,10 +4187,10 @@ static void testContainsProperly() {
        rtn = rt_raster_contains_properly(
                rast1, 0,
                rast2, 0,
-               &contains
+               &result
        );
        CHECK((rtn != 0));
-       CHECK((contains == 1));
+       CHECK((result == 1));
 
        deepRelease(rast2);
 
@@ -4229,10 +4229,10 @@ static void testContainsProperly() {
        rtn = rt_raster_contains_properly(
                rast1, 0,
                rast2, 0,
-               &contains
+               &result
        );
        CHECK((rtn != 0));
-       CHECK((contains != 1));
+       CHECK((result != 1));
 
        /*
                rast2
@@ -4262,10 +4262,10 @@ static void testContainsProperly() {
        rtn = rt_raster_contains_properly(
                rast1, 0,
                rast2, 0,
-               &contains
+               &result
        );
        CHECK((rtn != 0));
-       CHECK((contains != 1));
+       CHECK((result != 1));
 
        /*
                rast2
@@ -4293,10 +4293,10 @@ static void testContainsProperly() {
        rtn = rt_raster_contains_properly(
                rast1, 0,
                rast2, 0,
-               &contains
+               &result
        );
        CHECK((rtn != 0));
-       CHECK((contains != 1));
+       CHECK((result != 1));
 
        /*
                rast2
@@ -4324,10 +4324,10 @@ static void testContainsProperly() {
        rtn = rt_raster_contains_properly(
                rast1, 0,
                rast2, 0,
-               &contains
+               &result
        );
        CHECK((rtn != 0));
-       CHECK((contains != 1));
+       CHECK((result != 1));
 
        /*
                rast2
@@ -4355,10 +4355,10 @@ static void testContainsProperly() {
        rtn = rt_raster_contains_properly(
                rast1, 0,
                rast2, 0,
-               &contains
+               &result
        );
        CHECK((rtn != 0));
-       CHECK((contains != 1));
+       CHECK((result != 1));
 
        deepRelease(rast2);
 
@@ -4384,10 +4384,10 @@ static void testContainsProperly() {
        rtn = rt_raster_contains_properly(
                rast1, 0,
                rast2, 0,
-               &contains
+               &result
        );
        CHECK((rtn != 0));
-       CHECK((contains != 1));
+       CHECK((result != 1));
 
        /* rast2 (skewed by -1, 1) */
        rt_raster_set_skews(rast2, -1, 1);
@@ -4395,10 +4395,10 @@ static void testContainsProperly() {
        rtn = rt_raster_contains_properly(
                rast1, 0,
                rast2, 0,
-               &contains
+               &result
        );
        CHECK((rtn != 0));
-       CHECK((contains != 1));
+       CHECK((result != 1));
 
        /* rast2 (skewed by 1, -1) */
        rt_raster_set_skews(rast2, 1, -1);
@@ -4406,10 +4406,533 @@ static void testContainsProperly() {
        rtn = rt_raster_contains_properly(
                rast1, 0,
                rast2, 0,
-               &contains
+               &result
        );
        CHECK((rtn != 0));
-       CHECK((contains != 1));
+       CHECK((result != 1));
+
+       deepRelease(rast2);
+       deepRelease(rast1);
+}
+
+static void testCovers() {
+       rt_raster rast1;
+       rt_raster rast2;
+       rt_band band1;
+       rt_band band2;
+       double nodata;
+       int rtn;
+       int result;
+
+       /*
+               rast1
+
+               (-1, -1)
+                                               +-+-+
+                                               |1|1|
+                                               +-+-+
+                                               |1|1|
+                                               +-+-+
+                                                               (1, 1)
+       */
+       rast1 = rt_raster_new(2, 2);
+       assert(rast1);
+       rt_raster_set_offsets(rast1, -1, -1);
+
+       band1 = addBand(rast1, PT_8BUI, 1, 0);
+       CHECK(band1);
+       rt_band_set_nodata(band1, 0);
+       rtn = rt_band_set_pixel(band1, 0, 0, 1);
+       rtn = rt_band_set_pixel(band1, 0, 1, 1);
+       rtn = rt_band_set_pixel(band1, 1, 0, 1);
+       rtn = rt_band_set_pixel(band1, 1, 1, 1);
+
+       nodata = rt_band_get_nodata(band1);
+       CHECK_EQUALS(nodata, 0);
+
+       rtn = rt_raster_covers(
+               rast1, 0,
+               rast1, 0,
+               &result
+       );
+       CHECK((rtn != 0));
+       CHECK((result == 1));
+
+       /*
+               rast2
+
+               (0, 0)
+                                               +-+-+
+                                               |1|1|
+                                               +-+-+
+                                               |1|1|
+                                               +-+-+
+                                                               (2, 2)
+       */
+       rast2 = rt_raster_new(2, 2);
+       assert(rast2);
+
+       band2 = addBand(rast2, PT_8BUI, 1, 0);
+       CHECK(band2);
+       rt_band_set_nodata(band2, 0);
+       rtn = rt_band_set_pixel(band2, 0, 0, 1);
+       rtn = rt_band_set_pixel(band2, 0, 1, 1);
+       rtn = rt_band_set_pixel(band2, 1, 0, 1);
+       rtn = rt_band_set_pixel(band2, 1, 1, 1);
+
+       nodata = rt_band_get_nodata(band2);
+       CHECK_EQUALS(nodata, 0);
+
+       rtn = rt_raster_covers(
+               rast1, 0,
+               rast2, 0,
+               &result
+       );
+       CHECK((rtn != 0));
+       CHECK((result != 1));
+
+       rtn = rt_raster_covers(
+               rast1, -1,
+               rast2, -1,
+               &result
+       );
+       CHECK((rtn != 0));
+       CHECK((result != 1));
+
+       /*
+               rast2
+
+               (0, 0)
+                                               +-+-+
+                                               |0|1|
+                                               +-+-+
+                                               |1|1|
+                                               +-+-+
+                                                               (2, 2)
+       */
+       rtn = rt_band_set_pixel(band2, 0, 0, 0);
+
+       rtn = rt_raster_covers(
+               rast1, 0,
+               rast2, 0,
+               &result
+       );
+       CHECK((rtn != 0));
+       CHECK((result != 1));
+
+       /*
+               rast2
+
+               (0, 0)
+                                               +-+-+
+                                               |1|0|
+                                               +-+-+
+                                               |1|1|
+                                               +-+-+
+                                                               (2, 2)
+       */
+       rtn = rt_band_set_pixel(band2, 0, 0, 1);
+       rtn = rt_band_set_pixel(band2, 1, 0, 0);
+
+       rtn = rt_raster_covers(
+               rast1, 0,
+               rast2, 0,
+               &result
+       );
+       CHECK((rtn != 0));
+       CHECK((result != 1));
+
+       /*
+               rast2
+
+               (0, 0)
+                                               +-+-+
+                                               |0|0|
+                                               +-+-+
+                                               |0|1|
+                                               +-+-+
+                                                               (2, 2)
+       */
+       rtn = rt_band_set_pixel(band2, 0, 0, 0);
+       rtn = rt_band_set_pixel(band2, 1, 0, 0);
+       rtn = rt_band_set_pixel(band2, 0, 1, 0);
+
+       rtn = rt_raster_covers(
+               rast1, 0,
+               rast2, 0,
+               &result
+       );
+       CHECK((rtn != 0));
+       CHECK((result != 1));
+
+       /*
+               rast2
+
+               (0, 0)
+                                               +-+-+
+                                               |0|0|
+                                               +-+-+
+                                               |0|0|
+                                               +-+-+
+                                                               (2, 2)
+       */
+       rtn = rt_band_set_pixel(band2, 0, 0, 0);
+       rtn = rt_band_set_pixel(band2, 1, 0, 0);
+       rtn = rt_band_set_pixel(band2, 0, 1, 0);
+       rtn = rt_band_set_pixel(band2, 1, 1, 0);
+
+       rtn = rt_raster_covers(
+               rast1, 0,
+               rast2, 0,
+               &result
+       );
+       CHECK((rtn != 0));
+       CHECK((result != 1));
+
+       /*
+               rast2
+
+               (2, 0)
+                                               +-+-+
+                                               |1|1|
+                                               +-+-+
+                                               |1|1|
+                                               +-+-+
+                                                               (4, 2)
+       */
+       rt_raster_set_offsets(rast2, 2, 0);
+
+       rtn = rt_band_set_pixel(band2, 0, 0, 1);
+       rtn = rt_band_set_pixel(band2, 1, 0, 1);
+       rtn = rt_band_set_pixel(band2, 0, 1, 1);
+       rtn = rt_band_set_pixel(band2, 1, 1, 1);
+
+       rtn = rt_raster_covers(
+               rast1, 0,
+               rast2, 0,
+               &result
+       );
+       CHECK((rtn != 0));
+       CHECK((result != 1));
+
+       /*
+               rast2
+
+               (0, 1)
+                                               +-+-+
+                                               |1|1|
+                                               +-+-+
+                                               |1|1|
+                                               +-+-+
+                                                               (2, 3)
+       */
+       rt_raster_set_offsets(rast2, 0, 1);
+
+       rtn = rt_band_set_pixel(band2, 0, 0, 1);
+       rtn = rt_band_set_pixel(band2, 1, 0, 1);
+       rtn = rt_band_set_pixel(band2, 0, 1, 1);
+       rtn = rt_band_set_pixel(band2, 1, 1, 1);
+
+       rtn = rt_raster_covers(
+               rast1, 0,
+               rast2, 0,
+               &result
+       );
+       CHECK((rtn != 0));
+       CHECK((result != 1));
+
+       /*
+               rast2
+
+               (-1, 1)
+                                               +-+-+
+                                               |1|1|
+                                               +-+-+
+                                               |1|1|
+                                               +-+-+
+                                                               (1, 3)
+       */
+       rt_raster_set_offsets(rast2, -1, 1);
+
+       rtn = rt_band_set_pixel(band2, 0, 0, 1);
+       rtn = rt_band_set_pixel(band2, 1, 0, 1);
+       rtn = rt_band_set_pixel(band2, 0, 1, 1);
+       rtn = rt_band_set_pixel(band2, 1, 1, 1);
+
+       rtn = rt_raster_covers(
+               rast1, 0,
+               rast2, 0,
+               &result
+       );
+       CHECK((rtn != 0));
+       CHECK((result != 1));
+
+       /*
+               rast2
+
+               (0.1, 0.1)
+                                               +-+-+
+                                               |1|1|
+                                               +-+-+
+                                               |1|1|
+                                               +-+-+
+                                                               (0.9, 0.9)
+       */
+       rt_raster_set_offsets(rast2, 0.1, 0.1);
+       rt_raster_set_scale(rast2, 0.4, 0.4);
+
+       rtn = rt_band_set_pixel(band2, 0, 0, 1);
+       rtn = rt_band_set_pixel(band2, 1, 0, 1);
+       rtn = rt_band_set_pixel(band2, 0, 1, 1);
+       rtn = rt_band_set_pixel(band2, 1, 1, 1);
+
+       rtn = rt_raster_covers(
+               rast1, 0,
+               rast2, 0,
+               &result
+       );
+       CHECK((rtn != 0));
+       CHECK((result == 1));
+
+       /*
+               rast2
+
+               (-0.1, 0.1)
+                                               +-+-+
+                                               |1|1|
+                                               +-+-+
+                                               |1|1|
+                                               +-+-+
+                                                               (0.9, 0.9)
+       */
+       rt_raster_set_offsets(rast2, -0.1, 0.1);
+
+       rtn = rt_raster_covers(
+               rast1, 0,
+               rast2, 0,
+               &result
+       );
+       CHECK((rtn != 0));
+       CHECK((result == 1));
+
+       deepRelease(rast2);
+
+       /*
+               rast2
+
+               (0, 0)
+                                               +-+-+-+
+                                               |1|1|1|
+                                               +-+-+-+
+                                               |1|1|1|
+                                               +-+-+-+
+                                               |1|1|1|
+                                               +-+-+-+
+                                                                       (3, 3)
+       */
+       rast2 = rt_raster_new(3, 3);
+       assert(rast2);
+
+       band2 = addBand(rast2, PT_8BUI, 1, 0);
+       CHECK(band2);
+       rt_band_set_nodata(band2, 0);
+       rtn = rt_band_set_pixel(band2, 0, 0, 1);
+       rtn = rt_band_set_pixel(band2, 0, 1, 1);
+       rtn = rt_band_set_pixel(band2, 0, 2, 1);
+       rtn = rt_band_set_pixel(band2, 1, 0, 1);
+       rtn = rt_band_set_pixel(band2, 1, 1, 1);
+       rtn = rt_band_set_pixel(band2, 1, 2, 1);
+       rtn = rt_band_set_pixel(band2, 2, 0, 1);
+       rtn = rt_band_set_pixel(band2, 2, 1, 1);
+       rtn = rt_band_set_pixel(band2, 2, 2, 1);
+
+       nodata = rt_band_get_nodata(band2);
+       CHECK_EQUALS(nodata, 0);
+
+       rtn = rt_raster_covers(
+               rast1, 0,
+               rast2, 0,
+               &result
+       );
+       CHECK((rtn != 0));
+       CHECK((result != 1));
+
+       /*
+               rast2
+
+               (-2, -2)
+                                               +-+-+-+
+                                               |1|1|1|
+                                               +-+-+-+
+                                               |1|1|1|
+                                               +-+-+-+
+                                               |1|1|1|
+                                               +-+-+-+
+                                                                       (1, 1)
+       */
+       rt_raster_set_offsets(rast2, -2, -2);
+
+       rtn = rt_band_set_pixel(band2, 0, 0, 1);
+       rtn = rt_band_set_pixel(band2, 0, 1, 1);
+       rtn = rt_band_set_pixel(band2, 0, 2, 1);
+       rtn = rt_band_set_pixel(band2, 1, 0, 1);
+       rtn = rt_band_set_pixel(band2, 1, 1, 1);
+       rtn = rt_band_set_pixel(band2, 1, 2, 1);
+       rtn = rt_band_set_pixel(band2, 2, 0, 1);
+       rtn = rt_band_set_pixel(band2, 2, 1, 1);
+       rtn = rt_band_set_pixel(band2, 2, 2, 1);
+
+       rtn = rt_raster_covers(
+               rast1, 0,
+               rast2, 0,
+               &result
+       );
+       CHECK((rtn != 0));
+       CHECK((result != 1));
+
+       /*
+               rast2
+
+               (-2, -2)
+                                               +-+-+-+
+                                               |0|1|1|
+                                               +-+-+-+
+                                               |1|0|1|
+                                               +-+-+-+
+                                               |1|1|0|
+                                               +-+-+-+
+                                                                       (1, 1)
+       */
+       rtn = rt_band_set_pixel(band2, 0, 0, 0);
+       rtn = rt_band_set_pixel(band2, 0, 1, 1);
+       rtn = rt_band_set_pixel(band2, 0, 2, 1);
+       rtn = rt_band_set_pixel(band2, 1, 0, 1);
+       rtn = rt_band_set_pixel(band2, 1, 1, 0);
+       rtn = rt_band_set_pixel(band2, 1, 2, 1);
+       rtn = rt_band_set_pixel(band2, 2, 0, 1);
+       rtn = rt_band_set_pixel(band2, 2, 1, 1);
+       rtn = rt_band_set_pixel(band2, 2, 2, 0);
+
+       rtn = rt_raster_covers(
+               rast1, 0,
+               rast2, 0,
+               &result
+       );
+       CHECK((rtn != 0));
+       CHECK((result != 1));
+
+       /*
+               rast2
+
+               (-2, -2)
+                                               +-+-+-+
+                                               |0|1|1|
+                                               +-+-+-+
+                                               |1|0|0|
+                                               +-+-+-+
+                                               |1|0|0|
+                                               +-+-+-+
+                                                                       (1, 1)
+       */
+       rtn = rt_band_set_pixel(band2, 0, 0, 0);
+       rtn = rt_band_set_pixel(band2, 0, 1, 1);
+       rtn = rt_band_set_pixel(band2, 0, 2, 1);
+       rtn = rt_band_set_pixel(band2, 1, 0, 1);
+       rtn = rt_band_set_pixel(band2, 1, 1, 0);
+       rtn = rt_band_set_pixel(band2, 1, 2, 0);
+       rtn = rt_band_set_pixel(band2, 2, 0, 1);
+       rtn = rt_band_set_pixel(band2, 2, 1, 0);
+       rtn = rt_band_set_pixel(band2, 2, 2, 0);
+
+       rtn = rt_raster_covers(
+               rast1, 0,
+               rast2, 0,
+               &result
+       );
+       CHECK((rtn != 0));
+       CHECK((result != 1));
+
+       /*
+               rast2
+
+               (-2, -2)
+                                               +-+-+-+
+                                               |0|1|0|
+                                               +-+-+-+
+                                               |1|0|0|
+                                               +-+-+-+
+                                               |0|0|0|
+                                               +-+-+-+
+                                                                       (1, 1)
+       */
+       rtn = rt_band_set_pixel(band2, 0, 0, 0);
+       rtn = rt_band_set_pixel(band2, 0, 1, 1);
+       rtn = rt_band_set_pixel(band2, 0, 2, 0);
+       rtn = rt_band_set_pixel(band2, 1, 0, 1);
+       rtn = rt_band_set_pixel(band2, 1, 1, 0);
+       rtn = rt_band_set_pixel(band2, 1, 2, 0);
+       rtn = rt_band_set_pixel(band2, 2, 0, 0);
+       rtn = rt_band_set_pixel(band2, 2, 1, 0);
+       rtn = rt_band_set_pixel(band2, 2, 2, 0);
+
+       rtn = rt_raster_covers(
+               rast1, 0,
+               rast2, 0,
+               &result
+       );
+       CHECK((rtn != 0));
+       CHECK((result != 1));
+
+       deepRelease(rast2);
+
+       /* skew tests */
+       /* rast2 (skewed by -0.5, 0.5) */
+       rast2 = rt_raster_new(3, 3);
+       assert(rast2);
+       rt_raster_set_skews(rast2, -0.5, 0.5);
+
+       band2 = addBand(rast2, PT_8BUI, 1, 0);
+       CHECK(band2);
+       rt_band_set_nodata(band2, 0);
+       rtn = rt_band_set_pixel(band2, 0, 0, 1);
+       rtn = rt_band_set_pixel(band2, 0, 1, 2);
+       rtn = rt_band_set_pixel(band2, 0, 2, 3);
+       rtn = rt_band_set_pixel(band2, 1, 0, 1);
+       rtn = rt_band_set_pixel(band2, 1, 1, 2);
+       rtn = rt_band_set_pixel(band2, 1, 2, 3);
+       rtn = rt_band_set_pixel(band2, 2, 0, 1);
+       rtn = rt_band_set_pixel(band2, 2, 1, 2);
+       rtn = rt_band_set_pixel(band2, 2, 2, 3);
+
+       rtn = rt_raster_covers(
+               rast1, 0,
+               rast2, 0,
+               &result
+       );
+       CHECK((rtn != 0));
+       CHECK((result != 1));
+
+       /* rast2 (skewed by -1, 1) */
+       rt_raster_set_skews(rast2, -1, 1);
+
+       rtn = rt_raster_covers(
+               rast1, 0,
+               rast2, 0,
+               &result
+       );
+       CHECK((rtn != 0));
+       CHECK((result != 1));
+
+       /* rast2 (skewed by 1, -1) */
+       rt_raster_set_skews(rast2, 1, -1);
+
+       rtn = rt_raster_covers(
+               rast1, 0,
+               rast2, 0,
+               &result
+       );
+       CHECK((rtn != 0));
+       CHECK((result != 1));
 
        deepRelease(rast2);
        deepRelease(rast1);
@@ -5371,6 +5894,10 @@ main()
                testContainsProperly();
                printf("OK\n");
 
+               printf("Testing rt_raster_covers... ");
+               testCovers();
+               printf("OK\n");
+
                printf("Testing rt_raster_same_alignment... ");
                testAlignment();
                printf("OK\n");