Index: trunk/Ohana/src/opihi/dvo/gimages.c
===================================================================
--- trunk/Ohana/src/opihi/dvo/gimages.c	(revision 2598)
+++ trunk/Ohana/src/opihi/dvo/gimages.c	(revision 3393)
@@ -71,19 +71,11 @@
   if (!str_to_radec (&Ra, &Dec, argv[1], argv[2])) return (FALSE);
 
-  image = LoadImages (&Nimage);
-  if (Nimage == 0) {
-    return (FALSE);
-  }
+  if ((image = LoadImages (&Nimage)) == NULL) return (FALSE);
   image_subset (image, Nimage, &subset, &Nsubset, (Graphdata *) NULL, FALSE, tzero, trange, TimeSelect);
+  BuildChipMatch (image, Nimage);
 
   Nfound = 0;
   for (j = 0; j < Nsubset; j++) {
     i = subset[j];
-    status = RD_to_XY (&X, &Y, Ra, Dec, &image[i].coords);
-    if (!status || (X < 0) || (X > image[i].NX) || (Y < 0) || (Y > image[i].NY)) continue;
-    XY_to_RD (&ra, &dec, 0.5*image[i].NX, 0.5*image[i].NY, &image[i].coords);
-    Mcal = applyMcal (&image[i], 2048.0, 2048.0);
-    /* t = TimeValue (image[i].tzero, TimeReference, TimeFormat); */
-    date = sec_to_date (image[i].tzero);
     if (PhotCodeSelect) {
       if ((code[0].type == PHOT_REF) || (code[0].type == PHOT_DEP)) {
@@ -94,8 +86,21 @@
       } 
     }      
+    if (!FindMosaicForImage (image, Nimage, i)) continue;
+
+    status = RD_to_XY (&X, &Y, Ra, Dec, &image[i].coords);
+    if (!status) continue;
+    if (X < 0) continue;
+    if (Y < 0) continue;
+    if (X > image[i].NX) continue;
+    if (Y > image[i].NY) continue;
+
+    Mcal = applyMcal (&image[i], 2048.0, 2048.0);
+    date = sec_to_date (image[i].tzero);
+
     if (PixelCoords) {
       fprintf (GetOutfile(), "%3d %s %6.1f %6.1f %20s %5d %2d %4.2f %6.3f %5.3f %5.3f %4x\n", 
 	       Nfound, image[i].name, X, Y, date, image[i].nstar, image[i].source, 0.001*image[i].secz, 0.001*Mcal, 0.001*image[i].dMcal, image[i].exptime, image[i].code);
     } else {
+      XY_to_RD (&ra, &dec, 0.5*image[i].NX, 0.5*image[i].NY, &image[i].coords);
       fprintf (GetOutfile(), "%3d %s %8.4f %8.4f %20s %5d %2d %4.2f %6.3f %5.3f %5.3f %4x\n", 
 	       Nfound, image[i].name, ra, dec, date, image[i].nstar, image[i].source, 0.001*image[i].secz, 0.001*Mcal, 0.001*image[i].dMcal, image[i].exptime, image[i].code);
