help mif2dta                                                      Version 2.0.0
-------------------------------------------------------------------------------

Title

mif2dta -- Converts MapInfo Interchange Format files to Stata datasets

Syntax

mif2dta using miffile [, options]

options Description ------------------------------------------------------------------------- Main * type(spobj) spatial object type, where spobj is one of the following: polygon, polyline, point genid(idvar) generate spatial object id variable idvar gencentroids(stub) generate polygon centroid variables xstub and ystub

Saving results * attributes(attrfile) save spatial object attributes to Stata dataset attrfile coordinates(coordfile) save spatial object coordinates to Stata dataset coordfile replace overwrite datasets attrfile and coordfile if already existing ------------------------------------------------------------------------- * Required option

Description

mif2dta converts MapInfo Interchange Format files (aka MIF files) to Stata datasets usable by spmap, a user-written Stata program - available from the SSC Archive - aimed at visualizing spatial data.

Any logical MIF file miffile consists of two physical files that, for the purposes of mif2dta, must reside in the same directory:

o miffile.mif contains the coordinates that define the shape/location of n spatial objects of a given type. The current version of mif2dta supports three types of spatial objects: polygons, polylines, and points. Moreover, mif2dta can handle only MIF files that store spatial objects of a single type.

o miffile.mid contains the values taken on by one or more attributes of the spatial objects.

mif2dta converts the logical MIF file miffile specified by the user (see syntax diagram above) into one or two Stata datasets, depending on the type of spatial objects stored in miffile.

When option type(polygon) or type(polyline) is specified, mif2dta creates two Stata datasets:

o The attributes dataset attrfile, which contains the attributes of the spatial objects stored in miffile plus three variables optionally generated by mif2dta: the spatial object id variable idvar and - when option type(polygon) is specified - the polygon centroid variables xstub and ystub. It should be noted that, though not required, in most cases the creation of the spatial object id variable idvar is desirable, since it allows to establish a proper link between the attributes dataset and the coordinates dataset.

o The coordinates dataset coordfile, which contains the coordinates of the spatial objects stored in miffile. Expressly, coordfile includes three variables: _ID, a numeric variable that uniquely identifies the spatial objects; _X, a numeric variable containing the x-coordinate of the nodes making up the spatial objects; and _Y, a numeric variable containing the y-coordinate of the nodes making up the spatial objects.

In turn, when option type(point) is specified, mif2dta creates only the attributes dataset attrfile, which contains both the attributes of the points stored in miffile and the following three variables automatically generated by mif2dta: _ID, a numeric variable that uniquely identifies the points; _X, a numeric variable containing the x-coordinate of the points; and _Y, a numeric variable containing the y-coordinate of the points.

Options

+------+ ----+ Main +-------------------------------------------------------------

type(spobj) specifies the type of spatial objects stored in file miffile.

type(polygon) specifies that miffile stores a set of polygons.

type(polyline) specifies that miffile stores a set of polylines.

type(point) specifies that miffile stores a set of points.

genid(idvar) applies only when option type(polygon) or type(polyline) is specified. It requests that a new numeric variable idvar be generated and added to the attributes dataset attrfile, where it will uniquely identify the spatial objects stored in file miffile. The values taken on by variable idvar will correspond to the values taken on by variable _ID in the coordinates dataset coordfile.

gencentroids(stub) applies only when option type(polygon) is specified. It requests that the coordinates of the centroids of the polygons stored in file miffile be computed, saved in variables xstub and ystub, and added to the attributes dataset attrfile. When this option is specified, option genid(idvar) is required as well.

+----------------+ ----+ Saving results +---------------------------------------------------

attributes(attrfile) requests that the attributes of the spatial objects stored in file miffile be saved to Stata dataset attrfile.

coordinates(coordfile) applies only when option type(polygon) or type(polyline) is specified. It requests that the coordinates of the spatial objects stored in file miffile be saved to Stata dataset coordfile.

replace requests that datasets attrfile and coordfile be overwritten if already existing.

Examples

. mif2dta using Canada-Provinces, type(polygon) genid(id) /// gencentroids(_coord) attributes(CaProv-Attributes) /// coordinates(CaProv-Coordinates)

. mif2dta using Canada-Rivers, type(polyline) genid(rivid) /// a(CaRivers-Attributes) c(CaRivers-Coordinates)

. mif2dta using Canada-Cities, type(point) a(CaCities.dta) /// replace

Acknowledgments

I wish to thank Kevin Crow for writing shp2dta, which motivated the revision of mif2dta.

Author

Maurizio Pisati Department of Sociology and Social Research University of Milano Bicocca - Italy maurizio.pisati@unimib.it

Also see

Online: shp2dta (if installed), spmap (if installed)