Reading georeference coordinates from a file

It's easy to modify the script "View.GeoRefImage" to bring up the file picker instead of the coordinate entry dialog box. Let's assume that the file will be formatted as follows:

X1  Y1
X2  Y2
which is the typical output of the PROJECT FILE command in PC ARC/INFO. You will want to replace these lines of the script:

   ' **** get coordinates for second rectangle ************************

   labels = {"X1:", "Y1:", "X2:", "Y2:"}
   XYlist = MsgBox.MultiInput("Enter Map Coordinates", "Georeference Points", labels, {})
   if (XYlist.Count > 0) then
      X1 = XYlist.Get(0)
      Y1 = XYlist.Get(1)
      X2 = XYlist.Get(2)
      Y2 = XYlist.Get(3)
with these:

   ' **** get coordinates for second rectangle ************************

   pfilename = FileDialog.Show("*.*","All files","Coordinate File")
   if (pfilename <> nil) then
      pf = TextFile.Make(pfilename, #FILE_PERM_READ)
      instring = pf.Read(pf.GetSize)
      pf.Close
      X1 = instring.Extract(0)
      Y1 = instring.Extract(1)
      X2 = instring.Extract(2)
      Y2 = instring.Extract(3)

Back