TAB file format
Jacques Paris
jacques@paris-pc-gis.com
PRELIMINARY RELEASE
August 31, 2001
Some notes gathered through my own experience
offered for comments, additions, corrections…
available as a zipped pdf file for downloading from here
Identified versions
The version seems to be set automatically by MI to the minimum compatible with the table.
300 basic, most commonly used
400 when Metadata is present (*)
410 for MDB ACCESS files
450 for XLS files
500 for MIG files
(*) an assumption based on the appearance of Metadata functions in MB language version 4
Note: there may be different versions associated with the raster formats; new ones may have been included since the version 3 and that may have some effect on the version number. I do not have enough examples to verify all the formats recognized by MI in version 6.0: BIL, TIF, BMP, GIF, TGA, JPG, PCX. This list according to the help file does not include GRC that shows up in the "open file" requester and that may have been abandoned since version 3.
Format structure
header:
!table required
!version 300 required, variable, controlled by MI
!charset WindowsLatin1 required, variable, depending on user's choice
body:
commands:
These are MapBasic commands similar to those present in a WOR.
They are executed sequentially and before the next segment (table definition) is read. They cannot thus be applied to the table defined later on.
table definition:
Variations depending on the nature of the nature. See "Detailed table definitions"
metadata:
Metadata commands. They can be added to any tab file. They can be retrieved only if an application does it explicitly (as MI with the interpolator definition of a MIG file; see "Detailed table definitions")
The sequence of these 3 blocks must be respected but they may not all be present. The most frequent case calls only for table definition; that block can be sometimes followed by metadata (always, in a MIG file). There are rare examples of tabs with only a command block (see "Special examples"). Nothing stops us from imagining commands and table definition, and, why not, metadata, in the same TAB file.
Detailed table definitions
NATIVE (mapinfo) format
Definition Table | required |
Type NATIVE Charset "WindowsLatin1" | required, variable, depending on user's choice (note: different format from the header) |
Fields 4 | required, number of fields = number of lines following |
id Integer Index 1 ; |
column (field) name, - type, - index from1 to ... if column is indexed), - semicolon to end the line |
structure_type Char (13) ; | ... |
mast_type Char (15) ; | as many lines as the number of fields |
foundation_type Char (17) ; |
RASTER file
Definition Table | required |
File "sf_rastc.bil" | required, file name is that of an image file with an extension (format) recognized by MI |
Type "RASTER" | required |
(548421,4183579) (0,0) Label "Pt 1", | Control point definitions, as in the Image Registration requester. Number (minimum 3) can vary. Each line is ended by a comma but for the last one. |
(548441,4183579) (1,0) Label "Pt 2", | |
(548421,4183559) (0,1) Label "Pt 3" | |
CoordSys Earth Projection 8, 62, "m", -123, 0, 0.9996, 500000, 0 Units "m" | The coordsys clause is required. That information is not contained in the image file itself, a difference with the NATIVE tab (the associated MAP file contains that info). |
RasterStyle 2 62 | Expression not documented in
Help files. It
is probably the translation of some settings made with the "Adjust Image Style" requester. There may be more than one. |
Grid MIG table
Definition Table | required |
File "bidon_value.mig" | required, file name is that of a
file with the
MIG extension |
Type "RASTER" | required |
(297153.63503593224,5007379.3522604182) (0,0) Label "", | Control point definitions, see "raster" |
(312554.15366307431,5007379.3522604182) (204,0) Label "", | |
(312554.15366307431,4992205.3118483815) (204,201) Label "", | |
(297153.63503593224,4992205.3118483815) (0,201) Label "" | |
CoordSys Earth Projection 8, 33, "m", -73.5, 0, 0.9999, 304800, 0 Units "m" | see "raster" |
RasterStyle 6 1 | see "raster" |
begin_metadata | required. Metadata is generated by MI according to the choices made by the user when defining the parameters of the thematic layer. Changes can be made to it directly with a text editor as long as they remain within the values acceptable by the interpolator |
"\Interpolator" = "IDW"
"\Interpolator\Version" = "100"
"\Interpolator\Parameter" = ""
"\Interpolator\Parameter\EXPONENT" = "2"
"\Interpolator\Parameter\MAX POINTS" = "25"
"\Interpolator\Parameter\MIN POINTS" = "1"
"\Interpolator\Parameter\SEARCH RADIUS" = "100"
"\Interpolator\Source Data" = ""
"\Interpolator\Source Data\Table" = "C:\MapInfo\Topics\Grid engine\bidon.TAB"
"\Interpolator\Source Data\Table\Is Permanent" = "TRUE"
"\Interpolator\Source Data\Expression" = "value"
"\Interpolator\Source Data\Expression Type" = "8"
"\Interpolator\Source Data\Expression Width" = "11"
"\Interpolator\Source Data\Expression Decimal Width" = "0"
"\Interpolator\Source Data\Grid Type" = "mig.ghl"
"\Interpolator\Source Data\Grid Coordsys" = "CoordSys Earth Projection 8, 33, ""m"", -73.5, 0, 0.9999, 304800, 0"
"\IsReadOnly" = "FALSE"
"\Legend" = ""
"\Legend\Title" = "bidon by value"
"\Inflections" = ""
"\Inflections\Spread Method" = "2"
"\Inflections\Round By" = "1"
end_metadata
Delimited ASCII
Definition Table | required |
Type ASCII Delimiter 09 Titles Charset "WindowsLatin1" | required, variable, Delimiter (09=tab), Titles (present if first line of the file contains field names), Charset see NATIVE |
Fields 3 | required, see NATIVE |
Start Float ; | … |
End Float ; | |
Side Char (6) ; |
EXCEL XLS file
Definition Table | required |
Type XLS Titles Range "Sheet1" | required, variable, Titles (present if first line of the range contains field names), Range depending on user’s specification |
Fields 3 |
required, see NATIVE |
A Float ; |
… |
B Float ; | |
C Char (6) ; |
LOTUS WK* file
Definition Table | required |
File "lotus.wk4" | required, variable, file name is
that of a file
with a WK* extension |
Type WKS Titles | required, variable, Titles (present if first line of the range contains field names) |
Fields 1 |
required, see NATIVE |
A Char (1) ; |
… |
ACCESS MDB file
Definition Table | required |
File "sample.mdb" | required, file name is that of a file with the MDB extension |
Type ACCESS TABLE "rdatbln_line" Charset "WindowsLatin1" |
required, variable, Table as identified when registering the MDB file, Charset see NATIVE
|
Fields 5 | see NATIVE |
FNODE_ Integer ; |
… |
TNODE_ Integer ; | |
LPOLY_ Integer ; | |
RPOLY_ Integer ; | |
LENGTH Float ; |
Special examples
I would love to develop a collection of special examples. I just have one for now and not necessarily the most interesting.
Indirect opening of a raster file with control of zoom layering
[Found in the data offered with MI6.0]. LONDON1 MapBasic commands open LONDON, display it in a mapper and set the zoom layering mini maxi parameters (by default, MI will set these values to 0.16 and 62 when it opens London). The result is a mapper with two layers of London, layer 1 with the zoom default values, layer 2 with the new values. I have been unable to remove layer 1 from the mapper from the tab file; it can be done from the layer control or the MapBasic window.
LONDON1.tab
!table
!version 300
!charset WindowsLatin1
open table "london.tab"
map from london
set map layer 1 zoom(.0001,100000)
LONDON.tab
!table
!version 300
!charset WindowsLatin1
Definition Table
File "london.bil"
Type "RASTER"
(297055,5717803) (0,0) Label "Pt 1",
(297065,5717803) (1,0) Label "Pt 2",
(297055,5717793) (0,1) Label "Pt 3"
CoordSys Earth Projection 8, 104, "m", 3, 0, 0.9996, 500000, 0 Units "m"
RasterStyle 1 48
RasterStyle 2 89