Index: trunk/pswarp/src/pswarpTransformTile.c
===================================================================
--- trunk/pswarp/src/pswarpTransformTile.c	(revision 34800)
+++ trunk/pswarp/src/pswarpTransformTile.c	(revision 35563)
@@ -89,4 +89,7 @@
 
     for (int y = yMin; y < yMax; y++) {
+
+      int yOut = y - outRow0; ///< Position on output image
+
         for (int x = xMin; x < xMax; x++) {
             // Only transform those pixels requested
@@ -94,4 +97,11 @@
                 continue;
             }
+
+	    int xOut = x - outCol0;
+
+	    // XXX the existing image may already have valid data -- probably should keep 
+	    // the best, but for the moment, just keep the pixel which is not NAN
+	    if (isfinite(outImageData[yOut][xOut])) continue;
+
             // pswarpMapApply converts the output coordinate (x,y) to the input coordinate.
             // both are in the parent frames of the input and output images.
@@ -127,8 +137,7 @@
             }
 
-            int xOut = x - outCol0, yOut = y - outRow0; ///< Position on output image
-
             if (outImageData) {
-                outImageData[yOut][xOut] = imageValue * jacobian;
+	      // XXX TEST outImageData[yOut][xOut] = value;
+	      outImageData[yOut][xOut] = imageValue * jacobian;
             }
             if (outVarData) {
