Convert tab file to text

1,323 views
Skip to first unread message

Cameron Sanderson-Brewster

unread,
Jun 26, 2012, 8:52:15 PM6/26/12
to MapInfo-L
Hi all,

I need to be able to extract all data from the .tab file and input
into a text file in a delaminated format. The text file does not need
header information but I need it composed in a format which can be
imported into a table.

Can anyone assist me with a script or recommend any free ware?

Thanks
Cam

Data Directions

unread,
Jun 26, 2012, 8:56:35 PM6/26/12
to mapi...@googlegroups.com
In MapInfo, simply use Table > Export and pulldown to "Files of Type"
Delimited ASCII (*.TXT)

You can then choose the format required.

Regards,

Bill

============================================================================
===
--
You received this message because you are subscribed to the Google Groups
"MapInfo-L" group.To post a message to this group, send email to
mapi...@googlegroups.com To unsubscribe from this group, go to:
http://groups.google.com/group/mapinfo-l/subscribe?hl=en
For more options, information and links to MapInfo resources (searching
archives, feature requests, to visit our Wiki, visit the Welcome page at
http://groups.google.com/group/mapinfo-l?hl=en


KTG Infotech

unread,
Jun 27, 2012, 2:56:24 AM6/27/12
to mapi...@googlegroups.com
Thats the easiest way without a script..
--
Kalai Selvan
KTG Infotech
CAD/GIS/Geo spatial Services
Skypes- ktgcad


Mac

unread,
Jun 27, 2012, 6:48:07 PM6/27/12
to mapi...@googlegroups.com

Thanks Bill. I should have provided more info. I maintain a database which has a land disturbance and rehabilitation component to it. The source of this information is stored within a Map Info layer file. The Map Info files are to be maintained as the source data. Each night I would like to update the database with any changes to the Map Info files.

Bo Victor Thomsen

unread,
Jun 28, 2012, 5:58:47 AM6/28/12
to mapi...@googlegroups.com
You can try this:

The workspace will: open a specific tabfile, export it a a csv file and then exit MapInfo

exportTab.wor:
==========================
!Workspace
!Version 600
!Charset WindowsLatin1

Dim tabFile as string
Dim csvFile as string

' Change the 2 lines to the right tab/csv filepath
tabFile = "c:\dummy\tabFileToExport.tab"
csvFile = "c:\dummy\newCsvFile.csv"

Open Table tabFile as temp

'Use this line if you want column titles
Export temp Into csvFile Type "ASCII" Delimiter "," CharSet "WindowsLatin1" Titles OverWrite

' Remove "Titles" part if you don't want column titles
' If you want another delimited than "," change the "," to ex. ";"
'Export temp Into csvFile Type "ASCII" Delimiter ";" CharSet "WindowsLatin1" OverWrite

Close Table temp

unDim tabFile
unDim csvFile

End MapInfo
============================

  • Paste the text between the "====="'s  into a textfile called exportTab.wor.
  • Change the variables tabFile and csvFile to the correct values
  • Doubleclick the exportTab.wor to check if it works.
  • In a dos prompt write the following command (It worked when I was using NT 4.0 !! - there is probably a better method available) :

    c:\> at 01:00 /interactive /every:M,T,W,Th,F c:\dummy\exportTab.Wor

    The command wil instruct the windows scheduler to execute "c:\dummy\exportTab.Wor" every workday mon-fri at 01:00 AM.

Regards
Bo Victor Thomsen
Aestas-GIS
Denmark

e.j.h.polle

unread,
Jun 28, 2012, 8:16:47 AM6/28/12
to mapi...@googlegroups.com
Hi Mac/Cam,


Can you please tell us something more about your setup, e.g. which Database Management System (DBMS) are you using?

In your current setup you are using a MapInfo table as the source file, and there is the need to export the attribute data on a daily basis to a txt file, only to re-import it into your DBMS, I suppose.

Did you consider the possibilities of 1) an ODBC connection and/or 2) a spatial database?

1) You can think of a situation where the geometry is maintained in a MapInfo table and the attribute data in a DBMS with an ODBC connection being used to link them together.

2) If your DBMS has spatial capabilities* you can store both geometry and attributes in your DBMS, using an ODBC connction to visualize your data in MapInfo Professional.

* Oracle Spatial, SQL Server, PostgreSQL/PostGIS (open source and free)

Just a few ideas - please let us know what you think. If you need any further information: the group will surely be able to help.


Cheers,


Egge-Jan
Reply all
Reply to author
Forward
0 new messages