Importing MIF/MID, PICT, or MapInfo for DOS Files - MapBasic - 2023

MapInfo MapBasic Reference

Product type
Software
Portfolio
Locate
Product family
MapInfo
Product
MapInfo > MapBasic
Version
2023
Language
English
Product name
MapBasic
Title
MapInfo MapBasic Reference
First publish date
1985
Last updated
2023-09-12
Published on
2023-09-12T16:32:32.686312

Syntax

Import file_name 
	[ Type file_type ] 
	[ Into table_name [ Type { NATIVE | NATIVEX } ]  ] 
	[ Overwrite ]

file_name is a string that specifies the name of the file to import.

file_type is a string that specifies the import file format (MIF, MBI, MMI, IMG, or PICT).

table_name specifies the name of the new table to create.

Description

The Import statement creates a new MapInfo table by importing the contents of an existing file.

Note: To create a MapInfo table based on a spreadsheet or database file, use the Register Table statement, not the Import statement.

The optional Type clause specifies the format of the file you want to import. The Type clause can take one of the following forms:

Type clause File Format Specified
Type "DXF" DXF file (a format supported by CAD packages, such as AutoCAD). See Importing DXF Files.
Type "MIF" MIF/MID file pair, created by exporting a MapInfo table.
Type "MBI" MapInfo Boundary Interchange, created by MapInfo for DOS.
Type "MMI" MapInfo Map Interchange, created by MapInfo for DOS.
Type "IMG" MapInfo Image file, created by MapInfo for DOS.
Type "GML" GML files. See Importing GML Files.
Type "GML21" GML 2.1 files. See Importing GML 2.1 Files.

If you omit the Type clause, MapInfo Pro assumes that the file's extension indicates the file format. For example, a file named "PARCELS.DXF" is assumed to be a DXF file. (For more about DXF, see Importing DXF Files.)

The Into clause lets you override the name and location of the MapInfo table that is created. If no Into clause is specified, the new table is created in the same directory location as the original file, with a corresponding file name. For example, on Windows, if you import the text file "WORLD.MIF", the new table's default name is "WORLD.TAB".

Use Into with the Type clause to specify whether to import into MapInfo (NATIVE) or MapInfo Extended (NATIVEX) format. The NATIVEX format supports table caches larger than 2GB in size and character sets UTF-8 and UTF-16. The optional Type clause must follow the Into clause if present. If not specified, then the NATIVE format is assumed. Note that this Type clause is different than the Type clause for the import file type.

If you include the optional Overwrite keyword, MapInfo Pro creates a new table, regardless of whether a table by that name already exists; the new table replaces the existing table. If you omit the Overwrite keyword, and the table already exists, MapInfo Pro does not overwrite the table.

Example

Sample importing using current MapInfo style:

Import "D:\midata\GML\test.gml" Type "GML" layer "TopographicLine" style 
auto off Into "D:\midata\GML\test_TopographicLine.TAB" Overwrite

The following example imports a MIF (MapInfo Interchange Format) file:

Import "WORLD.MIF"
	Type "MIF"
	Into "world_2.tab"

	Map From world_2