{smcl} {* 14mar2008}{...} {cmd:help mif2dta}{right:Version 2.0.0} {hline} {title:Title} {p 4 11 2} {hi:mif2dta} {hline 2} Converts MapInfo Interchange Format files to Stata datasets{p_end} {marker syntax}{title:Syntax} {p 8 15 2} {cmd:mif2dta} {helpb using} {it:miffile} [{cmd:,} {help mif2dta##options1:{it:options}}] {synoptset 35 tabbed}{...} {marker options1}{synopthdr:{help mif2dta##options2:options}{col 41}} {synoptline} {syntab: Main} {p2coldent :* {opt t:ype(spobj)}}spatial object type, where {it:spobj} is one of the following: {cmd:polygon}, {cmd:polyline}, {cmd:point}{p_end} {synopt :{cmdab:genid(}{help newvar:{it:idvar}}{cmd:)}}generate spatial object id variable {it:idvar}{p_end} {synopt :{opt genc:entroids(stub)}}generate polygon centroid variables {cmd:x}{it:stub} and {cmd:y}{it:stub}{p_end} {syntab: Saving results} {p2coldent :* {opt a:ttributes(attrfile)}}save spatial object attributes to Stata dataset {it:attrfile}{p_end} {synopt :{opt c:oordinates(coordfile)}}save spatial object coordinates to Stata dataset {it:coordfile}{p_end} {synopt :{opt replace}}overwrite datasets {it:attrfile} and {it:coordfile} if already existing{p_end} {synoptline} {p 4 6 2}* Required option{p_end} {marker desc}{title:Description} {pstd} {cmd:mif2dta} converts MapInfo Interchange Format files (aka MIF files) to Stata datasets usable by {cmd:spmap}, a user-written Stata program {hline 1} available from the SSC Archive {hline 1} aimed at visualizing spatial data. {pstd} Any logical MIF file {it:miffile} consists of two physical files that, for the purposes of {cmd:mif2dta}, must reside in the same directory: {phang2}{space 1}o{space 2}{it:miffile}.mif contains the coordinates that define the shape/location of {it:n} spatial objects of a given type. The current version of {cmd:mif2dta} supports three types of spatial objects: polygons, polylines, and points. Moreover, {cmd:mif2dta} can handle only MIF files that store spatial objects of a single type.{p_end} {phang2}{space 1}o{space 2}{it:miffile}.mid contains the values taken on by one or more attributes of the spatial objects.{p_end} {pstd}{cmd:mif2dta} converts the logical MIF file {it:miffile} specified by the user (see {help mif2dta##syntax:syntax diagram} above) into one or two Stata datasets, depending on the type of spatial objects stored in {it:miffile}. {pstd}When option {cmd:type(polygon)} or {cmd:type(polyline)} is specified, {cmd:mif2dta} creates two Stata datasets: {phang2}{space 1}o{space 2}The attributes dataset {it:attrfile}, which contains the attributes of the spatial objects stored in {it:miffile} plus three variables optionally generated by {cmd:mif2dta}: the spatial object id variable {it:idvar} and {hline 1} when option {cmd:type(polygon)} is specified {hline 1} the polygon centroid variables {cmd:x}{it:stub} and {cmd:y}{it:stub}. It should be noted that, though not required, in most cases the creation of the spatial object id variable {it:idvar} is desirable, since it allows to establish a proper link between the attributes dataset and the coordinates dataset.{p_end} {phang2}{space 1}o{space 2}The coordinates dataset {it:coordfile}, which contains the coordinates of the spatial objects stored in {it:miffile}. Expressly, {it:coordfile} includes three variables: _ID, a numeric variable that uniquely identifies the spatial objects; _X, a numeric variable containing the {it:x}-coordinate of the nodes making up the spatial objects; and _Y, a numeric variable containing the {it:y}-coordinate of the nodes making up the spatial objects.{p_end} {pstd}In turn, when option {cmd:type(point)} is specified, {cmd:mif2dta} creates only the attributes dataset {it:attrfile}, which contains both the attributes of the points stored in {it:miffile} and the following three variables automatically generated by {cmd:mif2dta}: _ID, a numeric variable that uniquely identifies the points; _X, a numeric variable containing the {it:x}-coordinate of the points; and _Y, a numeric variable containing the {it:y}-coordinate of the points.{p_end} {marker options2}{title:Options} {dlgtab:Main} {phang} {opt type(spobj)} specifies the type of spatial objects stored in file {it:miffile}. {phang2}{cmd:type(polygon)} specifies that {it:miffile} stores a set of polygons.{p_end} {phang2}{cmd:type(polyline)} specifies that {it:miffile} stores a set of polylines.{p_end} {phang2}{cmd:type(point)} specifies that {it:miffile} stores a set of points.{p_end} {phang} {cmdab:genid(}{help newvar:{it:idvar}}{cmd:)} applies only when option {bf:type(polygon)} or {bf:type(polyline)} is specified. It requests that a new numeric variable {it:idvar} be generated and added to the attributes dataset {it:attrfile}, where it will uniquely identify the spatial objects stored in file {it:miffile}. The values taken on by variable {it:idvar} will correspond to the values taken on by variable _ID in the coordinates dataset {it:coordfile}. {phang} {opt gencentroids(stub)} applies only when option {bf:type(polygon)} is specified. It requests that the coordinates of the centroids of the polygons stored in file {it:miffile} be computed, saved in variables {cmd:x}{it:stub} and {cmd:y}{it:stub}, and added to the attributes dataset {it:attrfile}. When this option is specified, option {opt genid(idvar)} is required as well. {dlgtab:Saving results} {phang} {opt attributes(attrfile)} requests that the attributes of the spatial objects stored in file {it:miffile} be saved to Stata dataset {it:attrfile}. {phang} {opt coordinates(coordfile)} applies only when option {bf:type(polygon)} or {bf:type(polyline)} is specified. It requests that the coordinates of the spatial objects stored in file {it:miffile} be saved to Stata dataset {it:coordfile}. {phang} {opt replace} requests that datasets {it:attrfile} and {it:coordfile} be overwritten if already existing. {title:Examples} {cmd} . 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 {title:Acknowledgments} {p 4 4 2} {txt}I wish to thank Kevin Crow for writing {cmd:shp2dta}, which motivated the revision of {cmd:mif2dta}. {title:Author} {p 4} Maurizio Pisati {p_end} {p 4} Department of Sociology and Social Research {p_end} {p 4} University of Milano Bicocca - Italy {p_end} {p 4} {browse "mailto:maurizio.pisati@unimib.it":maurizio.pisati@unimib.it} {title:Also see} {psee} Online: {helpb shp2dta} (if installed), {helpb spmap} (if installed) {p_end}