MapInfo TAB and MIF/MID
Driver short name
MapInfo File
Driver built-in by default
This driver is built-in by default
MapInfo datasets in native (TAB) format and in interchange (MIF/MID) format are supported for reading and writing. Update of existing TAB files is supported (append of new features, modifications and deletions of existing features, adding/renaming/deleting fields, ...). Update of existing MIF/MID files is not supported.
Note: In the rest of this document "MIF/MID File" is used to refer to a pair of .MIF + .MID files, and "TAB file" refers to the set of files for a MapInfo table in binary form (usually with extensions .TAB, .DAT, .MAP, .ID, .IND).
The MapInfo driver treats a whole directory of files as a dataset, and a single file within that directory as a layer. In this case the directory name should be used as the dataset name.
However, it is also possible to use one of the files (.tab or .mif) in a MapInfo set as the dataset name, and then it will be treated as a dataset with one single layer.
MapInfo coordinate system information is supported for reading and writing.
Driver capabilities
Supports Create()
This driver supports the GDALDriver::Create()
operation
Supports Georeferencing
This driver supports georeferencing
Supports VirtualIO
This driver supports virtual I/O operations (/vsimem/, etc.)
Creation Issues
The TAB File format requires that the bounds (geographical extents) of a new file be set before writing the first feature.
There is currently no automated setting of valid default bounds for each spatial reference system, so for the time being, the MapInfo driver sets the following default bounds when a new layer is created:
For a file in LAT/LON (geographic) coordinates: BOUNDS (-180, -90) (180, 90)
For any other projection: BOUNDS (-30000000 + false_easting, -15000000 + false_northing) (30000000 + false_easting, 15000000 + false_northing)
It is possible to override those bounds through two mechanisms.
specify a user-defined file that contain projection definitions with bounds. The name of this file must be specified with the
MITAB_BOUNDS_FILE
configuration option. This allows users to override the default bounds for existing projections, and to define bounds for new projections not listed in the hard-coded table in the driver. The format of the file is a simple text file with one CoordSys string per line. The CoordSys lines should follow the MIF specs, and MUST include the optional Bounds definition at the end of the line, e.g.# Lambert 93 French bounds CoordSys Earth Projection 3, 33, "m", 3, 46.5, 44, 49.00000000002, 700000, 6600000 Bounds (75000, 6000000) (1275000, 7200000)
It is also possible to establish a mapping between a source CoordSys and a target CoordSys with bounds. Such a mapping is specified by adding a line starting with "Source = " followed by a CoordSys (spaces before or after the equal sign do not matter). The following line should start with "Destination = " followed by a CoordSys with bounds, e.g.
# Map generic Lambert 93 to French Lambert 93, Europe bounds Source = CoordSys Earth Projection 3, 33, "m", 3, 46.5, 44, 49, 700000, 6600000 Destination = CoordSys Earth Projection 3, 33, "m", 3, 46.5, 44, 49.00000000001, 700000, 6600000 Bounds (-792421, 5278231) (3520778, 9741029)
use the
BOUNDS
layer creation option (see below)
If no coordinate system is provided when creating a layer, the projection case is used, not geographic, which can result in very low precision if the coordinates really are geographic. You can add "-a_srs WGS84" to the ogr2ogr commandline during a translation to force geographic mode.
MapInfo feature attributes suffer a number of limitations:
Only Integer, Real and String field types can be created. The various list, and binary field types cannot be created.
For String fields, the field width is used to establish storage size in the .dat file. This means that strings longer than the field width will be truncated
String fields without an assigned width are treated as 254 characters.
Dataset Creation Options
Dataset creation options can be specified in command-line tools using the syntax -dsco <NAME>=<VALUE>
or by providing the appropriate arguments to GDALCreate()
(C) or Driver.Create
(Python).
The following dataset creation options are supported:
FORMAT=[TAB/MIF]: To create MIF/MID instead of TAB files
SPATIAL_INDEX_MODE=[QUICK/OPTIMIZED]: Defaults to
QUICK
. In QUICK mode writing files can be about 5 times faster, but spatial queries can be up to 30 times slower. This can be set to OPTIMIZED to generate optimized spatial index.BLOCKSIZE=[512/1024/.../32256]: Defaults to
512
. (multiples of 512) Block size for .map files. MapInfo 15.2 and above creates .tab files with a blocksize of 16384 bytes. Any MapInfo version should be able to handle block sizes from 512 to 32256.STRICT_FIELDS_NAME_LAUNDERING=[YES/NO]: (GDAL >= 3.10) Defaults to
YES
. Replaces all non alphanumeric characters in dataset's field names by _ (underscope). For recent MapInfo can be set to NO.
Layer Creation Options
Layer creation options can be specified in command-line tools using the syntax -lco <NAME>=<VALUE>
or by providing the appropriate arguments to GDALDatasetCreateLayer()
(C) or Dataset.CreateLayer
(Python).
The following layer creation options are supported:
BOUNDS=<xmin,ymin,xmax,ymax>: Define custom layer bounds to increase the accuracy of the coordinates. Note: the geometry of written features must be within the defined box.
ENCODING=value: Define the encoding for field names and field values. The encoding name is specified in the format supported by
CPLRecode()
(e.g. ISO-8859-1, CP1251, CP1252 ...) and internally converted to MapInfo charsets names. Default value is '' (empty string) that equals to 'Neutral' MapInfo charset.Currently supported values for the encoding name are:
ENCODING value
MapInfo charset
description
"" (empty string)
Neutral
No character conversions performed.
UTF-8
UTF-8
UTF-8 (Works with recent MapInfo versions, since v15.2)
ISO-8859-1
ISO8859_1
ISO 8859-1 (UNIX)
ISO-8859-2
ISO8859_2
ISO 8859-2 (UNIX)
ISO-8859-3
ISO8859_3
ISO 8859-3 (UNIX)
ISO-8859-4
ISO8859_4
ISO 8859-4 (UNIX)
ISO-8859-5
ISO8859_5
ISO 8859-5 (UNIX)
ISO-8859-6
ISO8859_6
ISO 8859-6 (UNIX)
ISO-8859-7
ISO8859_7
ISO 8859-7 (UNIX)
ISO-8859-8
ISO8859_8
ISO 8859-8 (UNIX)
ISO-8859-9
ISO8859_9
ISO 8859-9 (UNIX)
EUC-JP
PackedEUCJapaese
UNIX, standard Japanese implementation.
CP1252
WindowsLatin1
CP1250
WindowsLatin2
CP1256
WindowsArabic
CP1251
WindowsCyrillic
CP1257
WindowsBalticRim
CP1253
WindowsGreek
CP1255
WindowsHebrew
CP1254
WindowsTurkish
Windows Eastern Europe
CP950
WindowsTradChinese
Windows Traditional Chinese
CP936
WindowsSimpChinese
Windows Simplified Chinese
CP932
WindowsJapanese
CP949
WindowsKorean
CP437
CodePage437
DOS Code Page 437 = IBM Extended ASCII
CP850
CodePage850
DOS Code Page 850 = Multilingual
CP852
CodePage852
DOS Code Page 852 = Eastern Europe
CP855
CodePage855
DOS Code Page 855 = Cyrillic
CP857
CodePage857
CP860
CodePage860
DOS Code Page 860 = Portuguese
CP861
CodePage861
DOS Code Page 861 = Icelandic
CP863
CodePage863
DOS Code Page 863 = French Canadian
CP864
CodePage864
DOS Code Page 864 = Arabic
CP865
CodePage865
DOS Code Page 865 = Nordic
CP869
CodePage869
DOS Code Page 869 = Modern Greek
(no iconv match)
LICS
Lotus worksheet release 1,2 character set
(no iconv match)
LMBCS
Lotus worksheet release 3,4 character set
DESCRIPTION=value: (GDAL >= 3.1.0) Friendly layer name (only for TAB format). Friendly names can be up to 256 characters long and can include most ASCII characters. Supported by MapInfo Pro v15.0 or higher.
STRICT_FIELDS_NAME_LAUNDERING=[YES/NO]: (GDAL >= 3.10) Defaults to
YES
. Replaces all non alphanumeric characters in layer's field names by _ (underscope). For recent MapInfo can be set to NO.
Configuration options
Configuration options can be specified in command-line tools using the syntax --config <NAME>=<VALUE>
or using functions such as CPLSetConfigOption()
(C) or gdal.config_options
(Python).
The following configuration options are available:
MITAB_BOUNDS_FILE=value: See Creation Issues.
MITAB_SET_TOWGS84_ON_KNOWN_DATUM=[YES/NO]: (GDAL >= 3.0.3) The default behavior, starting with GDAL 3.0.3, is NO. That is, the TOWGS84 parameters read from the .tab header will not be set on the Datum object of the CRS, when the datum can be inferred.