MapInfo MIF/MID Reader/Writer
The MapInfo Data Interchange Format (MIF) Reader/Writer allows FME to read and write Pitney Bowes MapInfo® import and export files.
MIF is a published ASCII format used by the MapInfo product for input and export. The MapInfo product documentation describes the MIF format and all constants it uses for color, style, symbol, and fill patterns.
MapInfo Interchange Format Files are often called MIF or MIF/MID files.
Overview
MapInfo is a two-dimensional (2D) system with no provision for transferring elevation data for each vertex in a MapInfo feature. However, point features can define an elevation attribute to store their elevation.
MIF files store both feature geometry and attribution. A logical MIF file consists of two physical files, having the following filename extensions:
Filename Extension |
Contents |
.mif |
Vector geometric data |
.mid |
Attributes for the geometric data |
These extensions are added to the basename of the MIF file.
The MapInfo reader and writer support the storage of point, line, polyline, arc, ellipse, rectangle, rounded rectangle, region (polygon), and text geometric data in .mif files. The MIF format also stores features with no geometry. Features having no geometry are referred to as having a geometry of none.
Each geometric entity present in a .mif file has display properties such as pen and brush width, pattern, and color. In addition, each entity has a row of attributes stored in an associated .mid file. A single .mif file contains many different types of geometry; however, the associated attribute in the .mid file must have the same number and type of fields for each entity in the .mif file. The order of the entries in the two files is synchronized. For example, the second geometric entity in the .mif file has the attributes held in the second row of the .mid file.
The number and type of attributes associated with each entity is specified by the user. There must be at least one attribute field in the .mid file.
The following example shows a MIF file containing three region entities. Note that the second polygon contains a hole, and the third polygon is an aggregate of two disjoint polygons, one of which contains a hole. Each geometric entity in turn corresponds with one record in the attribute table.
FME considers a MIF dataset to be a collection of MIF files in a single folder. The attribute definitions for each MIF file must be defined in the workspace before it can be read or written.
Reader Overview
The file names of the physical MIF files are constructed by using the folder specified by the Dataset parameter, the basename specified on the feature types, and the .mif (geometry) and .mid (attributes) extensions.
MIF files require at least one attribute to be defined. The attribute definition given must match the definition of the file being read. If it does not, translation is halted and the true definition of the MIF file’s attributes is logged to the log file. There are no restrictions on the field names of MIF attributes.
The MIF reader first scans the folder it is given for the MIF files defined in the workspace. For each MIF file that it finds, it checks to see if it that file is requested by looking at the list of feature types specified in the workspace. If a match is made, the MIF file is opened.
The MIF reader then extracts features from the file one at a time, and passes them to the rest of FME for further processing. When the file is exhausted, the MIF reader starts on the next file in the folder.
Optionally a single MIF file can be provided as the dataset. In this case, only that MIF file will be read.
Writer Overview
The MIF writer creates and writes feature data to MIF files in the folder specified by the Dataset parameter. Any old MIF files in existing folders are overwritten with the new feature data. As features are routed to the MIF writer, the MIF writer determines the file into which the features are written and outputs them accordingly. Many MIF files can be written during a single FME session.
The version of MIF files produced depends on the data being written. FME automatically writes the lowest possible version that still supports the data. For example, if time or datetime attributes are being written, or the coordinate system is Krovak S-JTSK, then the version will be set to at least 900; otherwise, it will be lower if the data can be supported in a lower version.
When the MIF writer receives a feature with an fme_color or fme_fill_color attribute, the writer will honor the color values. The only exception is when native MapInfo color settings are also present, in which case the native settings will take precedence.
The MIF writer will not create MIF files larger than 2 GB.