Index: /branches/eam_branches/ipp-20100621/Ohana/src/relastro/Makefile
===================================================================
--- /branches/eam_branches/ipp-20100621/Ohana/src/relastro/Makefile	(revision 28702)
+++ /branches/eam_branches/ipp-20100621/Ohana/src/relastro/Makefile	(revision 28703)
@@ -58,4 +58,5 @@
 $(SRC)/CoordOps.$(ARCH).o            \
 $(SRC)/FixProblemImages.$(ARCH).o    \
+$(SRC)/StarMaps.$(ARCH).o    \
 $(SRC)/high_speed_catalogs.$(ARCH).o  \
 $(SRC)/high_speed_objects.$(ARCH).o  \
Index: /branches/eam_branches/ipp-20100621/Ohana/src/relastro/include/relastro.h
===================================================================
--- /branches/eam_branches/ipp-20100621/Ohana/src/relastro/include/relastro.h	(revision 28702)
+++ /branches/eam_branches/ipp-20100621/Ohana/src/relastro/include/relastro.h	(revision 28703)
@@ -145,4 +145,9 @@
 int DoUpdateChips;
 int DoUpdateMosaics;
+
+// StarMap parameters:
+int NX_MAP;
+int NY_MAP;
+double DPOS_MAX;
 
 /*** relphot prototypes ***/
@@ -293,4 +298,5 @@
 StarData *getImageRef (Catalog *catalog, int Ncatalog, off_t im, off_t *Nstars, CoordMode mode);
 StarData *getImageRaw (Catalog *catalog, int Ncatalog, off_t im, off_t *Nstars, CoordMode mode);
+off_t getImageByID (off_t ID);
 
 Mosaic *getmosaics (off_t *N);
@@ -331,2 +337,7 @@
 int high_speed_objects (SkyRegion *region, Catalog *catalog);
 int MeasMatchesPhotcode(Measure *measure, PhotCode **photcodeSet, int Nset);
+
+int initStarMaps ();
+int updateStarMaps(Catalog *catalog);
+int createStarMapPoints();
+int checkStarMap(int N);
Index: /branches/eam_branches/ipp-20100621/Ohana/src/relastro/src/ConfigInit.c
===================================================================
--- /branches/eam_branches/ipp-20100621/Ohana/src/relastro/src/ConfigInit.c	(revision 28702)
+++ /branches/eam_branches/ipp-20100621/Ohana/src/relastro/src/ConfigInit.c	(revision 28703)
@@ -32,4 +32,8 @@
   GetConfig (config, "PM_TOOFEW",              "%d",  0, &PM_TOOFEW);
   GetConfig (config, "POS_TOOFEW",             "%d",  0, &POS_TOOFEW);
+
+  GetConfig (config, "RELASTRO_MAP_NX",        "%d",  0, &NX_MAP);
+  GetConfig (config, "RELASTRO_MAP_NY",        "%d",  0, &NY_MAP);
+  GetConfig (config, "RELASTRO_DPOS_MAX",      "%lf", 0, &DPOS_MAX);
 
   GetConfig (config, "GSCFILE",                "%s",  0, GSCFILE);
Index: /branches/eam_branches/ipp-20100621/Ohana/src/relastro/src/StarMaps.c
===================================================================
--- /branches/eam_branches/ipp-20100621/Ohana/src/relastro/src/StarMaps.c	(revision 28702)
+++ /branches/eam_branches/ipp-20100621/Ohana/src/relastro/src/StarMaps.c	(revision 28703)
@@ -26,5 +26,5 @@
 
 static StarMap     *starmap;         
-static int         Nstarmap;
+// static int         Nstarmap;  -- is it always == Nimages?
 
 /** we have two possible options for how the user defines the map bins:
@@ -56,5 +56,6 @@
 
   Image *images;
-  off_t i, Nimages;
+  off_t i, N, Nimages;
+  int xbin, ybin;
 
   images = getimages(&Nimages);
@@ -81,4 +82,5 @@
   Image *images;
   off_t i, Nimages;
+  int ix, iy;
 
   images = getimages(&Nimages);
@@ -91,14 +93,14 @@
     for (ix = 0; ix < NX_MAP; ix++) {
       for (iy = 0; iy < NY_MAP; iy++) {
-	if (starmap[i].stars[iybin*NX_BAP + ixbin] < 1) continue;
+	if (starmap[i].stars[iy*NX_MAP + ix] < 1) continue;
 	StarMapPoint *point = &starmap[i].points[starmap[i].Npoints];
 	starmap[i].Npoints++;
 
 	// set the pixel coordinates
-	point[0].X = ixbin * NX_MAP; // XXX fix 0.5 pixel offset
-	point[0].Y = iybin * NY_MAP; // XXX fix 0.5 pixel offset
+	point[0].X = ix * NX_MAP; // XXX fix 0.5 pixel offset
+	point[0].Y = iy * NY_MAP; // XXX fix 0.5 pixel offset
 
 	// set the transformed coordinates
-	XY_to_LM (&point[0].L, &point[0].M, point[0].X, point[0].Y, &image[i].coords);
+	XY_to_LM (&point[0].L, &point[0].M, point[0].X, point[0].Y, &images[i].coords);
 
 	point[0].dL = 0.0;
@@ -124,15 +126,16 @@
 
     // set the transformed coordinates
-    XY_to_LM (&L, &M, starmap[N].point[i].X, starmap[N].point[i].Y, &image[N].coords);
+    XY_to_LM (&L, &M, starmap[N].points[i].X, starmap[N].points[i].Y, &images[N].coords);
 
-    starmap[N].point[i].dL = starmap[N].point[i].L - L;
-    starmap[N].point[i].dM = starmap[N].point[i].M - M;
+    starmap[N].points[i].dL = starmap[N].points[i].L - L;
+    starmap[N].points[i].dM = starmap[N].points[i].M - M;
 
-    dLmax = MAX(starmap[N].point[i].dL, dLmax);
-    dMmax = MAX(starmap[N].point[i].dM, dMmax);
+    dLmax = MAX(starmap[N].points[i].dL, dLmax);
+    dMmax = MAX(starmap[N].points[i].dM, dMmax);
   }
 
-  if (dLmax > XXX) return (FALSE);
-  if (dMmax > XXX) return (FALSE);
+  // XXX these need to be set somehow
+  if (dLmax > DPOS_MAX) return (FALSE);
+  if (dMmax > DPOS_MAX) return (FALSE);
   return (TRUE);
 }
