Mr. SID uses a slightly different "world file".  Here's the hack of
"TFWREAD.MB" that we use.
No promises ... <grin>


'* SDWRead.MB
'*    A raster registration tool for opening Mr. Sid images using .SDW
files
'*              (hacked from TFWRead.MB)
'*
'***********************************************************************
**
'***********************************************************************
**
'Include statements
'***********************************************************************
**
include "mapbasic.def"
dim sTFWFileName as string
sTFWFileName = FileOpenDlg(ApplicationDirectory$() ,  "" ,  "SDW" ,  
"Select the .SDW file needed to register image:" )
if ""=sTFWFileName then
  end program
end if
open file sTFWFileName for input as #1
dim f_dX1, f_dY1, f_dX2, f_dY2, f_X0, f_Y0, f_X1, f_Y1, f_X2, f_Y2 as
float
input #1, f_dX1
input #1, f_dY1
input #1, f_dX2
input #1, f_dY2
input #1, f_X0
input #1, f_Y0
f_X1 = f_X0 + f_dX1
f_Y1 = f_Y0 + f_dY1
f_X2 = f_X0 + f_dX2
f_Y2 = f_Y0 + f_dY2

dim sBaseFileName as string
sBaseFileName = PathToFilename$(sTFWFileName)
sBaseFileName = left$(sBaseFileName,len(sBaseFileName)-4)  'strip off
the extension

dim sTabFileName as string
sTabFileName = PathToDirectory$(sTFWFileName) + sBaseFileName + ".TAB"
dim bContinue as logical
if FileExists(sTabFileName) then
  bContinue = Ask("Overwrite the existing " + sTabFileName + "?", "OK",
"Cancel")
  if not bContinue then
    end program
  end if
end if
Dim strCSys as string
strCSys = ChooseProjection$("", True)
open file sTabFileName for output as #2
print #2, "!table"
print #2, "!version 300"
print #2, "!charset WindowsLatin1"
print #2, ""
print #2, "Definition Table"
print #2, "  File """ + sBaseFileName + ".sid"""
print #2, "  Type ""RASTER"""
print #2, "  (" + format$(f_X0,"#.########") + "," +
format$(f_Y0,"#.########")
+ ") (0,0) Label ""Pt 1"","
print #2, "  (" + format$(f_X1,"#.########") + "," +
format$(f_Y1,"#.########")
+ ") (1,0) Label ""Pt 2"","
print #2, "  (" + format$(f_X2,"#.########") + "," +
format$(f_Y2,"#.########")
+ ") (0,1) Label ""Pt 3"""
print #2, "  " + strCSys
close file #2
open table sTabFileName
map from TableInfo(0,TAB_INFO_NAME)


---------------------------------------------------------------------
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 5333

Reply via email to