📄 mapinfo_mif.txt
字号:
The MapInfo Interchange File (MIF)
Format Specification
MapInfo Corporation
Troy, NY
Information in this document is subject to change without notice and does not represent a commitment on the part of the vendor or
its representatives. No part of this document may be reproduced or transmitted in any form or by any means, electronic or
mechanical, including photocopying without the written permission of MapInfo Corporation, One Global View, Troy, New York
12180–8399.
.1992–1999 MapInfo Corporation. All rights reserved. MapInfo Help .1992–1999 MapInfo Corporation. All rights reserved.
MapInfo, MapInfo Professional, and the MapInfo “Rainbow” Logo are registered trademarks of MapInfo Corporation in the United
States Products named herein may be trademarks of their respective manufacturers and are hereby recognized. Trademarked names
are used editorially, to the benefit of the trademark owner, with no intent to infringe on the trademark. MapInfo welcomes your
comments and suggestions.
MapInfo Corporate Headquarters: MapInfo Europe Headquarters:
Voice: (518) 285–6000 England Germany
Fax: (518) 285–6060 voice: +44 (0)1753 848 200 voice: +49 6196 6700 0
Sales Info Hotline: (800) 327–8627 fax: +44 (0)1753 621 140 fax: +49 6196 6700 11
Federal Sales: (800) 619–2333
Technical Support Hotline: (518) 285–7283 Toll-free telephone support is available in the U.S. and Canada.
Technical Support Fax: (518) 285–6080 Contact your MapInfo sales representative for details. For
international customers, please use the Technical Support Fax
number.
Contact MapInfo Corporation on the Internet at: http://www.mapinfo.com
MapInfo Interchange File (MIF) Format Specification
October 1999
Introduction
This specification provides information about the MapInfo Interchange File (MIF) format. MIF
is an ASCII text file format that fully describes the contents of a MapInfo table. MIF consists of
two related files: one for the graphical data, and one for the tabular data. The graphical data is
in a file with a .mif extension, and the tabular data is in a file with a .mid extension. MIF files
can be read and written by MapInfo Professional and translated into other formats with other
programs. In this guide, you will find information on:
Chapter 1: MapInfo Data Interchange Format
. MIF File Header
. MIF Data Section
. Pen Styles
. Brush Styles
. Symbol Styles
. Font Styles
. Colors
. MID File
Chapter 2: Creating Your Own Coordinate System
. Projections and Coordinate Systems
. Elements of a Coordinate System
. Editing the MAPINFOW.PRJ File
. Affine Transformations
. Frequently Asked Questions on Projections
. More Information on Projections
Chapter 1: MapInfo Data Interchange Format
This chapter describes the data interchange format for MapInfo. In this chapter, you will find
information on:
. MIF File Header
. MIF Data Section
. Pen Styles
. Brush Styles
. Symbol Styles
. Font Styles
. Colors
. MID File
This versatile format allows generic data to be attached to a variety of graphical items. Since it
is ASCII, it is editable, relatively easy to generate, and works on all platforms supported by
MapInfo. Perhaps the best way to understand the MapInfo Interchange Format (MIF) is to
study the sample file at the end of this chapter in conjunction with the explanation of the file
format. You can also create samples of your own by exporting files to MIF and then examining
those files in a text editor.
MapInfo data is in two files - the graphics reside in a .MIF file and textual data is contained in
a .MID file. The textual data is delimited data, with one row per record and either Carriage
Return, Carriage Return plus Line Feed, or Line Feed between lines. The MIF file has two
areas - the file header area and the data section. Information on how to create MapInfo tables
is in the header; the graphical object definitions are in the data section.
MIF File Header
This is a description of MIF file header with optional information in square brackets.
VERSION n
Charset ”characterSetName”
[ DELIMITER ”<c>” ]
[ UNIQUE n,n.. ]
[ INDEX n,n.. ]
[ COORDSYS...]
[ TRANSFORM...]
COLUMNS n
<name> <type>
<name> <type>
.
.
DATA
Chapter 1: MapInfo Data Interchange Format
Version
The Version clause states whether you are using VERSION 1, VERSION 2, VERSION 300 or
VERSION 450 of the format. Version 300, introduced with MapInfo 3.0, allows multiple–
section polyline objects. VERSION 450 introduced the expanded node limit: the maximum
number of nodes for regions and polylines is 1,048,572 nodes for a single polygon region or
polyline. The limit drops by seven nodes for every two additional polygons.If an object with
more than 32K nodes is saved and the table is read in a version of MapInfo prior to version 4.5,
the object(s) will not be visible. Objects in the table that do not exceed the 32K limit will be
visible. VERSION 450 also includes point sized pen width.
Charset
The Charset clause specifies which character set was used to create text in the table. For
example: Specify “WindowsLatin1” to indicate that the file was created using the Windows
US & Western Europe character set; specify “MacRoman” to specify the Macintosh US &
Western Europe character set; or specify “Neutral” to avoid converting the text into another
character set. If you are not using one of these character sets, you can determine the correct
syntax for your character set by exporting a table and examining the .MIF file in a text editor.
Delimiter
Specify the delimiting character in quotation marks, for example:
DELIMITER ”;”
The default delimiter is Tab; if you are using the default, you do not need the DELIMITER line.
Unique
Specify a number. This number refers to a database column; 3 is the third column, 7 is the
seventh column, and so forth. What happens to columns in the UNIQUE list is subtle. For
example, imagine that you have a database with highways in it. Each highway has only one
name, but it might be represented by several segments. You would put the NAME column in
the UNIQUE list, while the column containing data for the individual segments would not be
in that list. This has the effect of creating two related tables; one with names, and one with the
other attributes of the objects. This is how MapInfo’s various street maps (StreetInfo) are
prepared.
Chapter 1: MapInfo Data Interchange Format
Index
To indicate that columns in the table are indexed, include a number (or a comma–separated
list of numbers) in the Index clause. Each number refers to a database column; 3 is the third
column, 7 is the seventh column, and so forth. Columns in the INDEX list will have indexes
prepared for them.
CoordSys Clause
Specify the COORDSYS clause to note that the data is not stored in longitude/latitude form.
When no COORDSYS clause is specified, data is assumed to be stored in longitude/latitude
forms.
All coordinates are stored with respect to the northeast quadrant. The coordinates for points in
the United States have a negative X while coordinates for points in Europe (east of Greenwich)
have a positive X. Coordinates for points in the Northern hemisphere have a positive Y while
coordinates for points in the Southern hemisphere have a negative Y.
Syntax1
CoordSys Earth
[ Projection type,
datum,
unitname
[ , origin_longitude]
[ , origin_latitude ]
[ , standard_parallel_1 [ , standard_parallel_2 ] ]
[ , azimuth ]
[ , scale_factor ]
[ , false_easting ]
[ , false_northing]
[ , range] ]
[ Affine Units unitname, A, B C, D, E, F ]
[ Bounds ( minx, miny) ( maxx, maxy) ]
Syntax2
CoordSys Nonearth
[ Affine Units unitname, A, B C, D, E, F ]
Units unitname
Bounds ( minx, miny) ( maxx, maxy)
Chapter 1: MapInfo Data Interchange Format
Syntax3
CoordSys Layout Units paperunitname
Syntax4
CoordSys Table tablename
Syntax5
CoordSys Window window_id
type is a positive integer value representing which coordinate system to use
datum is a positive integer value identifying which datum to reference
unitname is a string representing a distance unit of measure (e.g. -m" for meters); for a
list of unit names, see Set Distance Units
origin_longitude is a float longitude value, in degrees
origin_latitude is a float latitude value, in degrees
standard_parallel_1 and standard_parallel_2 are float latitude values, in degrees
azimuth is a float angle measurement, in degrees
scale_factor is a float scale factor
range is a float value from 1 to 180, dictating how much of the Earth will be seen
minx is a float specifying the minimum x value
miny is a float specifying the minimum y value
maxx is a float specifying the maximum x value
maxy is a float specifying the maximum y value
paperunitname is a string representing a paper unit of measure (e.g. -in" for inches); for
a list of unit names, see Set Paper Units
tablename is the name of an open table
window_id is an Integer window identifier corresponding to a Map or Layout window
A performs scaling or stretching along the X axis.
B performs rotation or skewing along the X axis.
C performs shifting along the X axis.
D performs scaling or stretching along the Y axis.
E performs rotation or skewing along the Y axis.
F performs shifting along the Y axis.
Chapter 1: MapInfo Data Interchange Format
Transform Clause
When you have MIF files with coordinates stored with respect to the northwest quadrant
(quadrant 2), you can transform them to the northeast quadrant (quadrant 1) with a transform
clause.
Quadrant 2:
Quadrant 1:
Northwest Quadrant
Northeast Quadrant
Quadrant 3:
Quadrant 4:
Southwest Quadrant
Southeast Quadrant
The transform clause has the following syntax:
TRANSFORM Xmultiplier, Ymultiplier, Xdisplacement,
Ydisplacement
To transform quadrant 2 data into quadrant 1 data, use the following transform clause:
TRANSFORM -1,0,0,0
The zeroes instruct MapInfo to ignore that parameter.
When you have an application which creates MIF files in quadrant 2, you can:
. Add the TRANSFORM clause to the MIF files
. Change the application so that it creates coordinates in quadrant 1
. Change the application so that it adds a TRANSFORM clause to the MIF files
Columns
Specify the number of columns. Then, for each column, create a row containing the column
name, the column type, and, for character and decimal columns, a number to indicate the
width of the field. Valid column types are:
. char (width)
. integer (which is 4 bytes)
. smallint (which is 2 bytes, so it can only store numbers between -32767 and +32767)
. decimal (width,decimals)
. float
. date
. logical
Chapter 1: MapInfo Data Interchange Format
This is an example of the columns section of the header:
COLUMNS 3
STATE char (15)
POPULATION integer
AREA decimal (8,4)
For the database specified in this header, the MID file has three columns:
a 15 character field that represents the STATE column,
an integer field that represents the POPULATION column,
an AREA column that consists of a decimal field with up to 8 total characters (digits,
decimals points, and optional sign) and 4 digits after the decimal.
MIF Data Section
The data section of the MIF file follows the header and must be introduced with DATA on a
single line:
DATA
The data section of the MIF file can have any number of graphical primitives, one for each
graphic object. MapInfo matches up entries in the MIF and MID files, associating the first
object in the MIF file with the first row in the MID file, the second object in the MIF file with
the second row in the MID file, and so on.
When there is no graphic object corresponding to a particular row in the MID file, a “blank”
object (NONE) must be written as a place holder in the corresponding place in the MIF file.
NONE
The graphical objects that can be specified are:
. point
. line
. polyline
. region
. arc
. text
. rectangle
. rounded rectangle
. ellipse
Chapter 1: MapInfo Data Interchange Format
A point object takes two parameters; an X coordinate and a Y coordinate. As an option,
specify the symbol that represents the point. Symbols are designated by numbers. If you omit
the SYMBOL clause, the current symbol is used.
POINT x y
[ SYMBOL (shape, color, size)]
MapInfo 4.0 also supports two variations on the SYMBOL clause; see Symbol discussion later
in this chapter.
A line objects requires four parameters; an X and a Y coordinate for each end point. As an
option, specify a pen type. When no pen type is specified, the current pen type is used.
LINE x1 y1 x2 y2
[ PEN (width, pattern, color)]
A polyline object consists of one or more sections. If the polyline has more than one section,
include the MULTIPLE keyword, followed by the number of sections. For each section, specify
a numpts argument (which indicates the number of nodes in that section), followed by an x/y
coordinate pair for each node. Use the optional PEN clause (described later in this chapter) to
specify the line style. If you include the optional SMOOTH keyword, the polyline is
smoothed.
PLINE [ MULTIPLE numsections ]
numpts1
x1 y1
x2 y2
:
[ numpts2
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -