S�ren Breddam just made me aware that I was refering to a home made function of mine 
(GetFileNameAbsolutePath$). Sorry for not including this in the previous mail. You'll 
find it here

'******************************************************************************************
'       Returns name of file - with full path - using the given path if the existing 
path is relative...
'******************************************************************************************
Function GetFileNameAbsolutePath$(ByVal szFile As String, ByVal szPath As String) As 
String

        If szFile = "" Then
                GetFileNameAbsolutePath$ = szPath
        ElseIf not Mid$(szFile, 2, 2) = ":\" And not Left$(szFile, 2) = "\\" Then
                If NOT Right$(szPath, 1) = "\" Then
                        GetFileNameAbsolutePath$ = szPath & "\" & szFile
                Else
                        GetFileNameAbsolutePath$ = szPath & szFile
                End If
        Else
                GetFileNameAbsolutePath$ = szFile
        End If

End Function
'*****************************************************

Peter Horsb�ll M�ller
GIS Developer
Geographical Information & IT
 
COWI A/S
Odensevej 95
DK-5260 Odense S.
Denmark
 
Tel     +45 6311 4900
Direct  +45 6311 4908
Mob     +45 5156 1045
Fax     +45 6311 4949
E-mail  [EMAIL PROTECTED]
http://www.cowi.dk/gis


-----Original Message-----
From: S�ren Breddam [mailto:[EMAIL PROTECTED] 
Sent: Thursday, October 21, 2004 11:53 PM
To: Peter Horsb�ll M�ller
Subject: SV: MI-L Path to raster from TAB file?


Hej Peter!
Smart at lave det til en Function :-)
Jeg har n�sten samme kode i min WORtjek - men jeg benytter ikke:
                szPath = PathToDirectory$(szTabFile)
                szFile = GetFileNameAbsolutePath$(szFile, szPath)
Der er noget lidt mere kompliceret knudekode, men det er fordi, jeg har
pr�vet at gemme en kopi af en raster.tab. S� st�r de fx:   File
"H:\GIS\Ortofoto\kx-1212.ecw", selvom tabfilen ligger i C:\(...)\MineTabeller\ S� 
fejler din kode desv�rre. & det g�r Jakob Lanstorps ogs�, selvom den nu egentlig er 
ret smart... (jeg har slet ikke t�nkt i de baner) Det eneste der er galt er, at du 
skal tjekke, om der er en sti defineret imellem Chr$(34)x2. Hvis der ikke er det (se 
fx om der er en backslash), s� kan du k�re videre - ellers er din raster = szFile 

Venligst 

S�ren Breddam




-----Oprindelig meddelelse-----
Fra: Peter Horsb�ll M�ller [mailto:[EMAIL PROTECTED]
Sendt: 21. oktober 2004 22:05
Til: Jakob Lanstorp; Jay C Russell
Cc: [EMAIL PROTECTED]
Emne: RE: MI-L Path to raster from TAB file?


Hi Jay,

I did dig this up from a source file of mine:

'***************************************************************************
*******************''
'Returns the name of the raster file af tab file refers to
'***************************************************************************
*******************''
Function GetRasterFileFromTabFile$(ByVal szTabFile As String) As String

Dim     szLine, szPath, szFile As String,
        i, j As Integer

OnError GoTo ErrorOccured

GetRasterFileFromTabFile$ = ""

        If not FileExists(szTabFile) Then
                Exit Function
        End If

        Open File szTabFile
                For Input Access Read
                As #9
                CharSet SystemInfo(SYS_INFO_CHARSET)

        Line Input #9, szLine
        Do Until EOF(9)
                If Left$(LTrim$(szLine),4) = "File" Then
                        i = InStr(1, szLine, """")
                        j = InStr(i + 1, szLine, """")
                        If i > 0 and j > 0 Then
                                szFile = Mid$(szLine, i + 1, j - i - 1)
                                Exit Do
                        End If
                End If
                Line Input #9,szLine
        Loop

        Close File #9

        If szFile <> "" Then
                szPath = PathToDirectory$(szTabFile)
                szFile = GetFileNameAbsolutePath$(szFile, szPath)
        End If

        GetRasterFileFromTabFile$ = szFile

        Exit Function
'-------------------------
ErrorOccured:
        Note "Some error occured: " & Error$()

End Function
'************************************************************************

I hope it can be of some help for you,

Peter Horsb�ll M�ller
GIS Developer
Geographical Information & IT
 
COWI A/S
Odensevej 95
DK-5260 Odense S.
Denmark
 
Tel     +45 6311 4900
Direct  +45 6311 4908
Mob     +45 5156 1045
Fax     +45 6311 4949
E-mail  [EMAIL PROTECTED]
http://www.cowi.dk/gis


-----Original Message-----
From: Jakob Lanstorp [mailto:[EMAIL PROTECTED] 
Sent: Thursday, October 21, 2004 9:27 PM
To: Jay C Russell
Cc: [EMAIL PROTECTED]
Subject: RE: MI-L Path to raster from TAB file?


I guess you in MapInfo when you are trying to pull the raster path. There you can run 
a 
print tableinfo("MYTABLE",19) this returns only the tab path not the raster path. If 
you know the raster type you can swap the tab extension to sid or what ever type of 
your raster. If you donsen't know the raster extension you will just have to try all 
raster extension with a FileExists function in MapBasic or some place else.
 
Mvh. | Regards

Jakob Lanstorp
Senior Consultant
Geographical Information & IT

COWI A/S
Odensevej 95
DK-5260 Odense S
 
Tel       +45 63 11 49 00
Direct   +45 63 11 48 62
Fax      +45 63 11 49 49
Email     [EMAIL PROTECTED]
http://www.cowi.dk 

________________________________

From: Jay C Russell [mailto:[EMAIL PROTECTED]
Sent: Thu 10/21/2004 20:39
To: [EMAIL PROTECTED]
Subject: MI-L Path to raster from TAB file?







Is there any way to pull out the actual path to a raster file from its associated TAB 
file? Here is an example of the TAB file format, but I would like to avoid having to 
parse this file to get the path setting.

!Table:
!Version 300
!Charset WindowsLatin1

Definition Table
  File "\\gistest\Aerials\2002 AERIALS\77xx\7757.SID"
  Type "RASTER"
  (3453298.2761889999 ,721699.24370300001)  (0,0) Label "Pt 1.1" ,
  (3453299.2761889999 ,721699.24370300001)  (1,0) Label "Pt 1.2" ,
  (3453298.2761889999 ,721698.24370300001)  (0,1) Label "Pt 1.3" ,
  (3453398.2761889999 ,721599.24370300001)  (100,100) Label "Pt 2.1" ,
  (3453398.2761889999 ,721699.24370300001)  (100,0) Label "Pt 2.2" ,
  (3453298.2761889999 ,721599.24370300001)  (0,100) Label "Pt 2.3" ,
  (3453498.2761889999 ,721499.24370300001)  (200,200) Label "Pt 3.1" ,
  (3453498.2761889999 ,721699.24370300001)  (200,0) Label "Pt 3.2" ,
  (3453298.2761889999 ,721499.24370300001)  (0,200) Label "Pt 3.3"
  CoordSys Earth Projection 3, 62, "survey ft", -99, 27.8333333333, 28.3833333333, 
30.2833333333, 2000000, 0 Bounds (-221554461.125,
-185747019.928) (225554461.125, 261361902.322)
  Units "survey ft"


Thanks in advance,
Jay Russell



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





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


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

Reply via email to