getting data files into (and out of)...

26
51 4 Getting data files into (and out of) MapInfo 4 Understanding MapInfo: A Structured Guide Ian Johnson 1996. Archaeology (P&H), University of Sydney

Upload: votuyen

Post on 06-Mar-2018

291 views

Category:

Documents


4 download

TRANSCRIPT

Page 1: Getting data files into (and out of) MapInfoheuristscholar.org/APPLICATIONS/understanding_mapinfo/Chapter 4.pdf · 51 4 Getting data files into (and out of) MapInfo AAAA A AAA A AAA

51

4

Getting datafiles into (and

out of) MapInfo

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

4Understanding MapInfo: A Structured Guide

Ian Johnson 1996. Archaeology (P&H), University of Sydney

Page 2: Getting data files into (and out of) MapInfoheuristscholar.org/APPLICATIONS/understanding_mapinfo/Chapter 4.pdf · 51 4 Getting data files into (and out of) MapInfo AAAA A AAA A AAA

52

EXISTING DATA

This chapter is primarily concerned with data which already exist in a database, spreadsheet,CAD package, desktop mapping package or GIS. You can safely skip it if your data is alreadyin MapInfo format or you will be entering data from scratch.

Direct entry of tabular data through a Browser or the Info tool, and drawing of map objectswith the mouse or digitiser, are covered in chapters 6, 7 and 9. Exporting maps as bitmaps orvector images will be covered in chapter 10.

There are several programs available on the GISNet MapInfo FTP site (Appendix I) forconverting data from other programs or file formats to MapInfo. These include tools forArc/Info, MicroStation, GRASS, Idrisi, SAS, DLG and Tiger94.

TABULAR-DATA-ONLY FILES

Data in a conventional database may relate to objects (in the broadest sense) such as plants,animals, buildings or incidents, but will not generally carry graphical or map representations ofthose objects. These data are referred to as tabular data, as contrasted with map data, whichare the outlines or symbols used to represent objects on a map (see chapter 2).

Often these data will consist of point objects, i.e. objects which have no substantial size orshape in relation to the map as a whole - they are merely represented by a point (or symbol) atsome location specified by an X,Y coordinate pair. Typical point data will be samplinglocations, plant observations, species sightings, incidents, archaeological sites, artefacts, orbuildings (although each of these may be treated as polygon data under other circumstances).

Point objects can be simply created from their geographic location using the Table>CreatePoints command (page 64) so they are easily imported as a file containing tabular data alone.Line and area map objects are more problematical, requiring creation of an outline throughdrawing or digitising, or through import from an external source. Import of line and area objectstherefore generally requires data in a tabular + graphical data format, such as AutoCADDrawing Exchange Format or MapInfo Interchange Format (pages 58 - 63), or the joining oftabular data with existing map objects (page 175).

The first part of this chapter deals with files containing tabular data only.

Opening tabular data files

MapInfo's File>Open Table (Ctrl-O) command allows MapInfo to open tabular data files inseveral common formats and turn them into MapInfo tables (the original file is not affected bythis process - MapInfo simply creates a .TAB file to tell it how to access the data in the originalfile). Select the format using the File Format pull-down list on the Open Table dialogue box.

h

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

4Getting data files into (and out of) MapInfo

Page 3: Getting data files into (and out of) MapInfoheuristscholar.org/APPLICATIONS/understanding_mapinfo/Chapter 4.pdf · 51 4 Getting data files into (and out of) MapInfo AAAA A AAA A AAA

53

The formats currently supported are:

DBase (.DBF)Delimited ASCII (.TXT)Lotus 1-2-3 spreadsheet (*.WK1/S/3/4)1

Microsoft Excel spreadsheet (*.XLS)

Tables opened in this way will contain tabular data only, since these formats do not allow formap objects. Map objects can be added with the Table>Create Points command (page 64) orby joining the table of tabular data with another table containing map objects (page 175).

The File>Open Table command will also open raster (bitmap) images - pages 11, 219. Once araster file has been opened once it will appear as a MapInfo format table on future Open Tabledialogues.

ODBC tables

MapInfo can also access data in the formats listed above, and in a number of other commonformats including SQL server databases, through ODBC (Open Database Committee) driversusing File>Open ODBC Table. A discussion of ODBC drivers is beyond the scope of thisvolume: if you already have data you want to access in this way, consult the ODBC sections ofMapInfo Reference (pages 243 - 256, 317, 423) and MapInfo User's Guide (chapter 19 andAppendix D), or your network administrator.

DBase files

MapInfo will pick up the field names and types automatically from DBase files. Transferbetween MapInfo and DBase format is two-way - MapInfo can modify both the file structureand the data in DBF files and recognises both structure and data modifications made by otherprograms.2 MapInfo's own internal tabular data file format (.DAT) is simply a modified DBaseDBF file (allowing additional field types).

Many database management systems can work directly with files in DBase DBF format,although functionality is generally restricted compared with the system's native format (e.g.Paradox can create and use DBF files but is restricted to DBase's limited range of field types). Itmay however be possible to program the database system to automatically transfer the datarequired by MapInfo into a DBase file on a regular, even continuously updated, basis (but seefollowing paragraph).

When MapInfo accesses a DBase table, it locks not just the record it is modifying but the entiretable. Simultaneous updating by MapInfo and a database management system is therefore notpossible. If one or more users require simultaneous access to the same tabular database usingboth MapInfo and a database management system, or if the database is frequently updated and

1 MapInfo only supports the older Lotus formats (Lotus 1-2-3 releases 1 - 4) with extensions WK1, WKS, WK3 and WK4and Excel up to the current version at time of release. You may have to save newer format files in a format compatiblewith an older version to allow MapInfo to access the file. MapInfo may also have problems with multiple worksheets -data should be restricted to the first worksheet.

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

42 Both programs should recognise if the tabular data has been modified by the other program and should rebuild their

index files accordingly. MapInfo seems to do this reliably. This does not always happen the other way round, requiringmanual index rebuilds in the database program when tabular data has been modified in MapInfo. This problem may bespecific to particular DBase or DBase-compatible implementations.

Getting data files into (and out of) MapInfo

Page 4: Getting data files into (and out of) MapInfoheuristscholar.org/APPLICATIONS/understanding_mapinfo/Chapter 4.pdf · 51 4 Getting data files into (and out of) MapInfo AAAA A AAA A AAA

54

you need to be able to display the latest data, you should use the ODBC table function ofMapInfo to access the data directly.

ODBC also gives MapInfo direct access to data in an SQL server application, allowingretrieval, insertion, update and deletion of records from any server database supporting theODBC standard. The server application and MapInfo's ODBC table function will take care ofmanaging record locking and other functions required to handle multiple users and maintainintegrity of the data.

Spreadsheet and ASCII delimited files

Transfers between MapInfo and spreadsheet or ASCII delimited formats are strictly one-way,data source to MapInfo. Neither the structure nor the data in a spreadsheet or ASCII delimitedfile is modifiable from within MapInfo.

?

If the structure of a spreadsheet or ASCII delimited file is changed by another program,MapInfo may lose track of the data. The data values can, however, be changed by anotherprogram, and the updated data will be used by MapInfo.

!

Spreadsheet files

For spreadsheet files, MapInfo will pick up an entire worksheet or a defined block of cells.MapInfo will also read the field (column) names from the row preceding the defined block ifthe Use Row Above Selected Range for Column Titles box is checked:

MapInfo will automatically select the range of cells in the full worksheet, as shown by CurrentValue above. Pull down the list under Named Range to choose other worksheets within thespreadsheet file opened (if any). To select data from a specified range, select Other... from thepull-down list under Named Range and type in the cell range in the following dialogue:

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

4

MapInfo determines the field type for each column in the spreadsheet by looking at the valuesin the column. If any value is non-numeric, it will set the column to a character field type.

?

Field widths are determined from the column width set in the spreadsheet. If data in a columnexceed this width, the data will be truncated.

!

Getting data files into (and out of) MapInfo

Page 5: Getting data files into (and out of) MapInfoheuristscholar.org/APPLICATIONS/understanding_mapinfo/Chapter 4.pdf · 51 4 Getting data files into (and out of) MapInfo AAAA A AAA A AAA

55

h You will be well advised to save your spreadsheet files as a MapInfo native format file, usingFile>Save Copy As, to improve access speed and allow modifications to the file (e.g. additionof columns to hold calculated fields). See notes on pages 55 - 56.

There are some problems with opening .WK4 files with multiple worksheets and complexformatting, which may result in garbage. It is best to keep the data simple as you expect to seeit in the MapInfo table.

ASCII delimited files

If your data is stored in a database or spreadsheet other than those supported directly or throughDBase files or ODBC drivers, the software can almost certainly export ASCII delimited files,which MapInfo can open.

h One advantage of transferring data from a database system to MapInfo via a delimited file isthat the database system can be programmed, through a report, to combine a complex multi-table structure into a single file. This file may be easier for the MapInfo end-user to understandthan the multi-table structure, and can result in faster retrievals.

The main disadvantage of transferring data via an ASCII delimited file is that data transfer isone-way only, from the database to MapInfo. MapInfo cannot update an ASCII delimited file(and even if it could, there could be problems getting the data back into the original database).

If you are setting up a regular transfer of data from a frequently updated database or spreadsheetto MapInfo and require a set of standard symbols to represent, for example site type in a siteregister database, you may wish to use the VECTRANS or COMTRANS programs developed bythe Sydney University Archaeological Computing Laboratory (Appendix I).

It is very hard to work with tabular data without proper field names. For ASCII delimited files,the field names will be Col_1, Col_2, Col_3 etc. unless you enter the field names into the firstline of the file, separated by the same delimiting character as the rest of the file, and check the

ASCII file example

ID#,Length,Width,Material1,56.5,12,3,32,34.7,14.3,23,43.6,13.5,34,26.3,10.3,25,37.9,15.4,36,65.2,23.1,17,45.3,18.9,18,56.3,21.2,2

entry Use first line for column titles on the import dialogue box, as illustrated below:

? When you hit OK on this dialogue box, there will be a certain delay (during which an hourglasssymbol is displayed) while MapInfo reads your file and works out the field types, field widthsand other information. This delay can be up to a few minutes for very large files.

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

4Important

h Before you go any further, use File>Save Copy As to save your data as aMapInfo native format file (you will need to use a different table name from the

Getting data files into (and out of) MapInfo

Page 6: Getting data files into (and out of) MapInfoheuristscholar.org/APPLICATIONS/understanding_mapinfo/Chapter 4.pdf · 51 4 Getting data files into (and out of) MapInfo AAAA A AAA A AAA

56

name of the file you opened). This copy, not the file you opened, is the one youwill use in MapInfo.

The reasons:

1. MapInfo will happily access your delimited ASCII or spreadsheet filedirectly, but it is appallingly slow. When saved in MapInfo format,operations such as thematic mapping can be as much as 10 - 20 times asfast;

!

2. Once saved in MapInfo format, the file can be modified: this is notpossible with an ASCII delimited data file or spreadsheet file, which isobligatorily read-only. Read-only tables are often a nuisance inexploratory applications, because you can't modify field types or addfields to hold calculated data.

Preparing ASCII delimited data

Write a comma or tab delimited file from your spreadsheet or database. In most cases it is bestto set up and save an appropriate output report or macro which automates the process, so thatyou can easily transfer the data again when the database is updated. Give the file a .TXTextension, as this is MapInfo's default extension for ASCII delimited files.

The output format should write only the variables you think you will need in MapInfo. Inparticular, avoid long text descriptions (i.e. notes). MapInfo will recognise short charactervalues (e.g. abbreviations) as unique values for thematic mapping and other operations, butnotes will only clutter up the MapInfo data files, making them very much larger and slowingdown retrievals. Character field width is set to hold the longest value found, so a singlecomment along the lines of 'Not quite sure if this is bone or wood' can turn a 5 characterabbreviation field into a 38 character field width - the unused length is stored for every record.

h

MapInfo will set fields to Character if any non-numeric character is found in the field, even ifthere is just one in many thousands of records, so it is important to ensure that numeric fieldscontain only numeric values (e.g. by using a database system and setting the field to a numeric-only type).

!

Field names

If possible, include instructions in your output format or macro to add a line at the beginning ofthe file containing the names of the fields/variables exported. If this line has not been included,use a text editor or wordprocessor to add it to the file before importing the data into MapInfo. Ifediting with a wordprocessor such as Word for Windows, make sure you Save As a straightASCII file - Text-only or ASCII text. MapInfo will not be able to read the file correctly if itcontains the wordprocessor's own special formatting instructions.

h

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

4Getting data files into (and out of) MapInfo

Page 7: Getting data files into (and out of) MapInfoheuristscholar.org/APPLICATIONS/understanding_mapinfo/Chapter 4.pdf · 51 4 Getting data files into (and out of) MapInfo AAAA A AAA A AAA

57

Map object coordinates

h For point objects the tabular data should contain two numeric fields which can be interpreted asX and Y coordinates (or longitude and latitude) of the objects in the database.

X and Y coordinates need not necessarily be precise coordinates - they can be, for example, thecoordinates of the centre of the grid square containing the object. If some objects are preciselylocated, while others are located only to a grid square, you should generally proceed as follows:

1. for precisely located objects, X and Y contain the actual coordinates;

2. for grid-square provenanced objects, X and Y contain the centre/centroid ofthe square (or other area);3

3. for non- or very poorly provenanced objects, leave blank.

A separate field should identify the accuracy of the positional information - either by recordingan error figure - e.g. 0 for precisely located material, 50 for 50 cm squares, 100 for metresquares etc.; or as a code, such as 1=precise, 2=50cm, 3=1 metre square etc. This field willprove invaluable as a selection mechanism when it comes to plotting shaded density maps ormaps of point location. Similar precision measures are generally required for sites andmonuments registers, or specimen recordings, where older records will often be quite imprecisewhile more recent ones will be much more accurate.

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

4

3 For squares recorded by the bottom-left or southwest corner, the centre can be calculated by adding half the square sizeto both X & Y.

Getting data files into (and out of) MapInfo

Page 8: Getting data files into (and out of) MapInfoheuristscholar.org/APPLICATIONS/understanding_mapinfo/Chapter 4.pdf · 51 4 Getting data files into (and out of) MapInfo AAAA A AAA A AAA

58

TABULAR-AND-MAP-DATA FILES

MapInfo can import both vector map data and tabular data from AutoCAD DXF files orMapInfo's own MIF/MID format files using Table>Import from the main menu:

Select the appropriate file type (MapInfo Interchange or AutoCAD DXF) from the ImportFormat pull-down.

MapInfo Interchange Format (MIF/MID)

MIF/MID files are ASCII text files which provide a very useful way of getting the data in andout of tables, and allow modification of the data using a wordprocessor or custom programbefore it is reloaded into MapInfo. The format of these files is fairly straightforward anddefined in detail in Appendix A of MapInfo Reference. An example is shown on the followingpage.

The MIF file contains data on map projection and a list of the fields in the tabular data,followed by the coordinate data and style defining the map objects. The MID file containstabular data for the objects in the MIF file, generally in a comma delimited format. The recordsin the MID file are matched one-to-one with the objects in the MIF file in the order they occur,so it is essential that the order of the objects/records in the two files is identical.

Numerous programs are available for conversion of proprietary CAD formats and dataexchange formats developed by other software developers or government agencies to MapInfo.Some of these will read the native format of the source package and write MapInfo MIF/MIDfiles. MapInfo MIF/MID format is also increasingly used as a data exchange format. Forexample, the Australian federal mapping authority, AUSLIG, will supply digital map datadirectly in MIF/MID files. See Appendix I for a partial list of sources.

Data from external sources can often be turned into MIF/MID format with a little judiciousediting and/or a wordprocessor macro or simple filter program. If editing with a wordprocessorsuch as Word for Windows, make sure you Save As a straight ASCII file - text-only or ASCIItext. MapInfo will not be able to read it if it contains the wordprocessor's own specialformatting instructions.

h

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

4Getting data files into (and out of) MapInfo

Page 9: Getting data files into (and out of) MapInfoheuristscholar.org/APPLICATIONS/understanding_mapinfo/Chapter 4.pdf · 51 4 Getting data files into (and out of) MapInfo AAAA A AAA A AAA

59

? If MapInfo cannot understand something in the MIF file, it will sometimes plough on to the endof the file before reporting an error. If an error message makes no sense in the context of theline number given, look for an error in the header records preceding DATA.

Example MIF and MID files

MIF (Header info & map objects)

Version 300 GENERAL

Charset "WindowsLatin1" HEADERS

Delimiter ","Index 5CoordSys NonEarth Units "cm" Bounds (0, 0) (2000, 2000)

Columns 16 FIELD

ITEMID Smallint DEFINITIONS

UNIT Float FOR

A_BAG Float TABULAR

A_BOX Smallint DATA

FUNCTION Char(9) MATERIAL Char(9) GLASSCOL Char(4) BONE_AML Char(9) BONE_TYP Char(9) CERAMDEC Char(9) _#ITEMS Smallint A_WGHT Float SHEL_TYP Char(9) XX Smallint YY Smallint ZZ Smallint

Data START MAPOBJECTS

Point 906 122 POINT

Symbol (42,16711680,6) OBJECTS

Point 968 242 Symbol (42,16711680,6)

Region 1 POLYGON

9 OBJECT

727.240504 458.648719763.60128 482.889231813.294304 502.281647843.594944 488.949359827.838592 465.920879812.082272 427.136079774.509504 407.743663730.876584 413.803791727.240504 458.648719 Pen (1,2,0) Brush (2,16777215,16777215) Center 785.417724 455.012655

Pline 8 POLYLINE

726.02848 333.810127 OBJECT

778.145568 341.082279778.145568 322.901899820.566464 327.749999841.17088 365.322783867.835456 332.598103911.468352 367.746831951.465152 348.354431 Pen (1,2,0)

GEOMETRICOBJECTS

Point 866.623424 471.981007 Symbol (35,12632256,12)Rect 926.012672 439.256335 991.461952 496.221519 Pen (1,2,0) Brush (2,16777215,16777215)Roundrect 952.677184 366.534815 1013.2784 416.227855 29.088608 Pen (1,2,0) Brush (2,16777215,16777215)Ellipse 764.81328 385.927215 873.895552 453.800623 Pen (1,2,0) Brush (2,16777215,16777215)Arc 803.598112 402.895567 1079.93968 606.515727 180 270 Pen (1,2,0)Line 878.74368 499.857583 969.645504 336.234175 Pen (1,2,0)

MID (Tabular data)

2328,2.3,1,15,"A-STRUCT","SLATE","","","","",23,770.32,"",730,369,1102329,2.3,2,15,"A-STRUCT","WOOD","","","","",21,81.31,"",887,412,1302330,2.3,3,15,"FOOD","SHELL","","","","",1,44.25,"COC",906,122,1052331,2.3,4,15,"FOOD","SHELL","","","","",1,2.06,"OY",968,242,1072332,2.3,5,15,"TW","FEW","","","","PW",1,10.75,"",793,190,1172333,2.3,6,15,"A-STRUCT","FE","","","","",1,56.75,"",950,134,1052334,2.3,7,15,"A-STRUCT","FE","","","","",1,13.82,"",920,389,1122335,2.3,8,15,"A-STRUCT","CSW","","","","GL",1,94.82,"",898,243,1292336,2.3,9,15,"KW","GL","OL","","","",1,55.2,"",954,232,1152337,2.3,10,15,"KW","GL","OL","","","",3,63.17,"",907,207,1222338,2.3,11,15,"KW","GL","CL","","","",1,3.11,"",985,127,1122339,2.3,12,15,"KW","GL","CL","","","",1,3.49,"",834,467,1102340,2.3,13,15,"KW","GL","CL","","","",1,15.14,"",838,178,1042341,2.3,14,15,"A-NONST","GL","GR-T","","","",1,8.94,"",799,358,1172342,2.3,15,15,"H-HOLD","CLINK","","","","",2,6.24,"",861,152,1012343,2.3,16,15,"A-STRUCT","MORT","","","","",4,3.89,"",817,113,1332344,2.3,17,15,"KW","GL","AMB","","","",1,7.89,"",969,410,1202345,2.3,18,15,"UN-IDFIED","FE","","","","",1,1697.9,"",965,124,121

Text in BOLD UPPERCASE

shown on the left isannotation and does notappear in the MIF file itself.Blank lines have also beenadded for clarity.

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

4Getting data files into (and out of) MapInfo

Page 10: Getting data files into (and out of) MapInfoheuristscholar.org/APPLICATIONS/understanding_mapinfo/Chapter 4.pdf · 51 4 Getting data files into (and out of) MapInfo AAAA A AAA A AAA

60

Drawing Exchange Format (DXF)

Like MapInfo MIF/MID files, AutoCAD DXF files are normally ASCII text files containingboth tabular data and map objects, but they are extremely verbose (20 KBytes of MapInfo datacan expand into as much as 2 MBytes of DXF data!) and consequently not nearly as easy tofollow as the MIF/MID format, should you have to look at their content.

Data is often available from organisations such as Government departments, utility companiesand surveyors in DXF format, particularly for development-related EIS, CRM or conservationwork. The DXF import capability of MapInfo 4 is much improved on previous versions, but youmay have to fiddle around a bit before you get such data to register correctly with other maplayers.

Import of DXF files is covered in detail in MapInfo Reference pages 161 - 168. This material iswell worth reading carefully if you have trouble getting DXF data into MapInfo and registeredwith other data layers. See also MapInfo User's Guide chapter 21 ("Projections and CoordinateSystems").

Importing DXF files

DXF files can contain multiple layers of data, each containing both map objects and tabulardata (attribute data). When a DXF file is selected in the Table>Import dialogue, MapInfo willscan the DXF file header to determine the layers present, and display them in the followingdialogue box:

You can select several DXF layers in this dialogue using standard Windows Shift-click andCtrl-click multiple selection. All the layers can be imported into one MapInfo table, but it isgenerally a good idea to import different layers into different tables, unless they contain verysimilar data, as this provides flexibility by allowing one to switch individual layers on and offand change object styles individually.

h

Checking the box Create Separate Tables causes each of the AutoCAD layers to be importedinto MapInfo as a separate table. When it is checked, the bottom left button changes from OKto Next>>. Clicking this button displays the DXF Table Name dialogue shown on thefollowing page, allowing the creation of different files with different characteristics for each ofthe DXF layers. This step is omitted if all layers are to be imported as a single table.

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

4 The check box for Preserve Attribute Data causes attribute (tabular) data to be imported aswell as map objects, in other words a table of attribute data is attached to the map objects. If the

h

Getting data files into (and out of) MapInfo

Page 11: Getting data files into (and out of) MapInfoheuristscholar.org/APPLICATIONS/understanding_mapinfo/Chapter 4.pdf · 51 4 Getting data files into (and out of) MapInfo AAAA A AAA A AAA

61

box is not checked, only the map objects are imported, with a single dummy field in the tabulardata.

! Importing the map objects alone is much faster than importing both map and tabular data. Ifyou have large DXF files, import one or two of the layers first without attributes to check thatthey are importing correctly and that the imported data registers with other data layers, beforeimporting all the layers with attribute data.

The check box for Preserve Blocks as Multi-Polygon Regions determines the handling of mapobjects made up of multiple polygons - see discussion of DXF import in MapInfo Reference,pages 161 - 168, for details.

? Note that MapInfo is rather picky about which particular variant of DXF it will accept. MapInfoVersion 4 is claimed to be compatible with files following the standards set by AutoCAD DXFversions 10 through 13.

Importing as separate tables

Checking the box Create Separate Tables and clicking the Next>> button, displays thefollowing dialogue:

The DXF layers selected in the first dialogue are listed with the proposed file name and thedefault treatment of blocks and attribute (tabular) data specified in the previous dialogue. Thetreatment of individual layers can be changed by highlighting the layer and modifying the checkboxes under Affects Selected Layer.

The table name can also be changed by clicking the Change Table Name button e.g. to avoidoverwriting existing tables shown by an X in the Table Exists column. When you click OK youwill be prompted with the Import into Table dialogue for each table, giving a further chance tochange the table name.

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

4Getting data files into (and out of) MapInfo

Page 12: Getting data files into (and out of) MapInfoheuristscholar.org/APPLICATIONS/understanding_mapinfo/Chapter 4.pdf · 51 4 Getting data files into (and out of) MapInfo AAAA A AAA A AAA

62

Data storing options

Pressing the Options button on the DXF Import Information dialogue, brings up thefollowing dialogue:

The radio buttons under Import Whole Numbers as and Import Floating-Point Numbers aswill be greyed out if there is no tabular data containing whole numbers or floating pointnumbers respectively. You will normally want to leave whole numbers as integers unless youplan to add decimal data or transform the data e.g. by converting metres to kilometres. You maywant to convert floating point numbers to decimals to obtain better display in browsers andgreater numeric accuracy (floats are only stored to 6 significant digits). The Store Handles andStore Only Visible Objects check boxes will also be greyed out if these CAD features have notbeen used in the file.

Since MapInfo has no provision for storing the elevation of nodes forming a map object,elevation data can only be stored as a field in the tabular data. Check Store Elevation if youwant the average of the third dimension (Z) for each object to be stored in the tabular data. Ifthe DXF file is two dimensional, a zero value will be stored in this field.

Projection

When importing DXF files, MapInfo defaults to a Non-Earth coordinate system. If you wantthe layer to have an Earth coordinate system, choose a projection with the Projection button. Ifyou do this, make sure that you enter the appropriate transformation coordinates in the SetCoordinate Transformation dialogue (below).

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

4Getting data files into (and out of) MapInfo

Page 13: Getting data files into (and out of) MapInfoheuristscholar.org/APPLICATIONS/understanding_mapinfo/Chapter 4.pdf · 51 4 Getting data files into (and out of) MapInfo AAAA A AAA A AAA

63

Coordinate transformations

Since many CAD drawings are not referenced to real-world coordinates, but use some arbitraryplan coordinates, MapInfo provides a means of converting between the two with SetTransformation:

! MapInfo uses the CAD coordinates for two points, together with their corresponding real-world(MapInfo) coordinates, to work out a transformation between the two systems. BecauseMapInfo works with latitude and longitude and projected coordinate systems for Earth maps,whereas CAD systems typically work with a plane cartesian system, the transformation will notbe perfect when dealing with large areas - see the Import section of MapInfo Reference (pages164 - 165) for a detailed discussion. Transformation is available on both import and export.

BITMAP FILES

The File>Open Table dialogue will also open raster image files (page 11) in BMP, GIF, TIF,PCX, JPG, TGA and BIL format as MapInfo tables. These can be registered (page 219) to thesame coordinate system as other mapped files, but cannot be manipulated - they are availableonly as non-transparent4 backdrops to vector data. They have no tabular data attached.

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

4

4 From version 4, one colour can be set as transparent - typically the background of a scanned drawing or logo, or a maskarea. Although the rest of the raster is opaque on-screen, raster images may be printed transparently on a laser printer, i.e.light colours will not necessarily mask underlying dark coloured objects.

Getting data files into (and out of) MapInfo

Page 14: Getting data files into (and out of) MapInfoheuristscholar.org/APPLICATIONS/understanding_mapinfo/Chapter 4.pdf · 51 4 Getting data files into (and out of) MapInfo AAAA A AAA A AAA

64

CREATING MAP OBJECTS

CREATING POINTS

Data imported from ASCII delimited, spreadsheet and database files will only contain tabulardata, i.e. data fields describing the objects to be plotted. They do not contain any map data, i.e.symbols or outlines which might be plotted on a map. To create this map data for point objects5

we use Table>Create Points:

In the dialogue box, select the fields you have used for X and Y. For longitude and latitude,longitude is the X coordinate (left to right) and latitude is the Y coordinate (bottom to top). Amultiplication factor of -1 allows inversion of a coordinate axis, for example longitudes west ofGreenwich or southern hemisphere latitudes which have been recorded as positive values. Othermultiplication factors allow conversion of units, for example 1000 would convert kilometrecoordinates to metre coordinates for use on a UTM map.

If your X or Y coordinate fields don't appear in the pull-down for Get X/Y coordinates fromcolumn it is because they are not defined as a numeric field type. Look for a non-numericcharacter in the imported data which has forced the field(s) to be defined as character type.Correct the data and reimport or convert the field type with Table>Maintenance>Table Structure (you will lose the faulty data unless it is corrected before converting the fieldtype).

?

If Table>Create Points is greyed out, check to see that you have at least one non read-onlytable open, with at least two numeric fields. MapInfo cannot create points for a table withoutnumeric X and Y coordinates in the tabular data.

?

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

4

5 For line and area objects, map data must generally be drawn, digitised or imported and then joined with the tabular data -see page 174. Map objects can also be created with MapBasic instructions (see page 66).

Getting data files into (and out of) MapInfo

Page 15: Getting data files into (and out of) MapInfoheuristscholar.org/APPLICATIONS/understanding_mapinfo/Chapter 4.pdf · 51 4 Getting data files into (and out of) MapInfo AAAA A AAA A AAA

65

Symbols

h You may wish to click on the symbol shown and select something more interesting than thedefault black square, e.g. a red triangle in 6 point size. Keep the symbols small (between 2 and6 point - you are not restricted to the minimum value of 9 shown in the pull-down list), so thatthe symbols don't obscure too much of the underlying maps and/or merge into one solid mass.You can change symbols later by selecting points to be changed (chapter 5) and usingOptions>Symbol Style (chapter 6), or through thematic mapping (chapter 8).

h If you have a small number of different categories of point in your data, and you want eachcategory to plot with a different symbol (e.g. open sites vs rockshelter sites, or stone vs bone vsceramics vs metal), select all the records for one category, using Query>Select (chapter 5), andrun Create Points for the Selection table choosing the desired symbol for that category. Repeatfor each of the categories. For large numbers of categories, you will need to use thematicmapping or import data via a conversion utility such as COMTRANS (available from the SydneyUniversity Archaeological Computing Laboratory) which sets symbol styles according to valuesfor a field in the tabular data.

Existing map objects

! If Table>Create Points is run on a table containing records which already have map dataassociated, no new map data is created for them. In other words, if you modify the X and Yfields in a record, or if you previously created points using the wrong fields, Create Points willnot create a new map object at the new location or delete the old map object (see next sectionfor a method of forcing the creation of new map objects, which may be more convenient thanthe method outlined below).

On the other hand, you can delete selected map objects from the map (with Edit>Clear MapObjects Only)6 and then run Create Points to create new map objects for those tabular recordswhose map objects have been deleted.

! Beware: Edit>Clear or the Delete key both delete the map objects and the tabular data.

An alternative way of deleting all map objects in a layer is to use Table>Maintenance>TableStructure and uncheck Table is Mappable, click OK, then repeat and re-check Table isMappable. This may be useful for very large tables, but you will lose the projection andcoordinate limits for the map data.

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

4

6 Edit>Clear Map Objects Only will only clear the current selection. If there is no current selection, the menu option willbe greyed out.

Getting data files into (and out of) MapInfo

Page 16: Getting data files into (and out of) MapInfoheuristscholar.org/APPLICATIONS/understanding_mapinfo/Chapter 4.pdf · 51 4 Getting data files into (and out of) MapInfo AAAA A AAA A AAA

66

CREATING OTHER TYPES OF MAP OBJECT

Table>Create Points will only create point objects for records in the tabular data which do nothave a map object attached. Use of a simple MapBasic instruction allows you to:

• Create line and area objects as well as point objects;

• Force creation of new objects for all records in a table or selection.

To use a MapBasic instruction, open the MapBasic window ( icon or Options>ShowMapBasic Window), type the instruction in the window and hit Enter.

The MapBasic instructions to create various types of object are as follows:

Update tablename Set obj = CreatePoint (X, Y)

Update tablename Set obj = CreateLine (X1, Y1, X2, Y2)

Update tablename Set obj = CreateCircle (X, Y, radius)

Update tablename Set obj = Centroid (obj)

Update tablename Set obj = Buffer (obj, smoothness, radius, "units")

Replace the italicised words as follows:

tablename Name of table to be updated

X, Y Names of (numeric) fields containing X and Y position of point orcentre of circle

X1, Y1, X2, Y2 Names of (numeric) fields containing start (X1,Y1) and end(X2,Y2) points of lines

radius Circle radius in miles (sic) or buffering radius in the unitsindicated by units

units The units for the buffering radius, e.g. "km", "mi", "m" etc.

smoothness The number of nodes to be created per 360 degrees of arc

For more information, see MapInfo Reference pages 138 - 139.

Note: CreatePoint, CreateLine etc. cannot be used as 'columns' within the Select clause of anSQL query (chapter 7).

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

4Getting data files into (and out of) MapInfo

Page 17: Getting data files into (and out of) MapInfoheuristscholar.org/APPLICATIONS/understanding_mapinfo/Chapter 4.pdf · 51 4 Getting data files into (and out of) MapInfo AAAA A AAA A AAA

67

Checking the data

Once you have created points or other map objects, display a map of the objects usingWindow>New Map Window (F3). This map will often only show part of the area, so useMap>View Entire Layer to show all the objects you have created.

? If all the objects cluster in a very small area, look for one or two objects which have spuriouscoordinates, e.g. 0,0 (particularly 0,0 longitude/latitude, which tends to be a long way frommost people's study areas, being in the Atlantic west of central Africa!).

Select the Info tool and click on any outlying objects to look at the tabular data (see page152 for a description of the Info tool). You will probably find a missing value (0), a typo, amisplaced decimal point, a negative value, or two values which have been run into one, in eitherthe X or Y fields.

h You can also look at several objects at once by selecting all the objects in question (see"Selection of map objects", page 86) and using Window>New Browser Window (F2) to viewdata for the Selection table.

ENTERING MAP OBJECTS DIRECTLY

h Map objects can be drawn or digitised and attached to records in existing tabular data directly,as follows:

Select a record without an attached map object in the browser;

Make a map window active by clicking in the title bar not on the map(clicking on the map itself will de-select the record in the browser);

Draw or digitise the object on the map (see chapters 6 and 9 for a discussionof drawing and digitising respectively).

The object will be automatically associated with the selected browser record.

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

4Getting data files into (and out of) MapInfo

Page 18: Getting data files into (and out of) MapInfoheuristscholar.org/APPLICATIONS/understanding_mapinfo/Chapter 4.pdf · 51 4 Getting data files into (and out of) MapInfo AAAA A AAA A AAA

68

GEOCODING

When we use Table>Create Points to attach point objects to records in a table, the recordsalready contain the geographic coordinates (X and Y or latitude and longitude) for the objects tobe created. Geocoding allows us to work out the appropriate geographic position for the pointsusing other data, typically street addresses, city or locality names. It does this by matching datain each record against tabular data attached to existing map objects in another table (known asthe search table).

Simple geocoding

For example, a list of historic monuments might include the name of the nearest village or town.Given a map with all the town and village locations, with their names attached as tabular data,geocoding would allow you to place a point object for each monument at the geographic locationof the corresponding town. To do this, it would match the NearestPlace field in the monumentstable (the geocode table) with the PlaceName field in the table of towns and villages (the searchtable), and create a point in the monuments table at the same location as the matched town orvillage. If the towns and villages are recorded as polygons rather than points, then the pointobject for the monument will be created at the centroid of the polygon.7

The column in the search table must be indexed. Tables without indexed columns will notappear in the pulldown list.

?

When geocoding is complete, MapInfo will tell you how many of the records in your table havebeen successfully geocoded, how many failed to match, and how many already had pointobjects attached. MapInfo only geocodes records where there is an exact match and there is noexisting map object.

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

4

7 MapInfo does not actually use the outline of the object when geocoding, merely its centroid. To allow geocoding basedon US zip codes, MapInfo comes with a special file ZipInfo containing point objects representing the centroids of eachUS Zipcode region, with the zip code attached to each point as tabular data.

Getting data files into (and out of) MapInfo

Page 19: Getting data files into (and out of) MapInfoheuristscholar.org/APPLICATIONS/understanding_mapinfo/Chapter 4.pdf · 51 4 Getting data files into (and out of) MapInfo AAAA A AAA A AAA

69

h Your next step will probably be to find out which records failed to geocode and fix theproblems. To retrieve all the non-geocoded records, use Query>Select or Query>SQL Selectwith the selection criteria Not obj, for example:

Select * from MONUMENT where NOT obj into SelectionBrowse * From Selection

These records may have failed to geocode because the name being matched was incorrectlyspelt (look out for differences in spacing between words) or because the name you wanted tomatch does not exist in the search table.

If there are geocoding failures due to misspellings in the table being geocoded (or, lesscommonly, the search table), or if you can add to the search table, make these corrections andrun Table>Geocode again.

Another way of obtaining additional matches is to check the Interactive radio button on theinitial geocode dialogue. When a record fails to geocode, MapInfo displays a variant of theFind dialogue (pages 102 - 105), allowing you to manually select an appropriate matching placefrom the search table. MapInfo shows potential matches which are alphabetically close to thevalue in the table being geocoded:

This can be useful where there are alternative spellings (as in transliteration of non-Englishnames) or you have local knowledge which may allow you to link local names with largerplaces.

If the value you are trying to match is misspelt, is a transliteration, or can be replaced with analternative name, you can make the correction in the field at the top of this dialogue and hitEnter. The new value will be matched with the search table and geocoded if a match is found,or a new list of potential matches will be displayed if not. Note that changing the value heredoes not affect the data value in the table being geocoded.

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

4Getting data files into (and out of) MapInfo

Page 20: Getting data files into (and out of) MapInfoheuristscholar.org/APPLICATIONS/understanding_mapinfo/Chapter 4.pdf · 51 4 Getting data files into (and out of) MapInfo AAAA A AAA A AAA

70

Address-based geocoding

MapInfo has no way of knowing where in a polygon the point object belongs, which is why thepoint object is placed at the centroid. If the polygons are small in relation to the whole map (forexample, individual suburbs or logging coupes on a regional map) or if you simply want toshade polygons according to number of incidents - this may be quite satisfactory.8 However,you will generally require a more precise location when dealing with larger scale maps,particularly street maps and individual house addresses. Given appropriate information aboutstreet numbering, MapInfo can make an intelligent guess at positioning points at the appropriateposition along the street, based on the street address. MapInfo Corporation and other dataproviders sell special StreetInfo databases9 which contain the necessary street objects, streetnames and address ranges to allow geocoding to street address.10

MapInfo allows for abbreviations, such as St or Str for Street, Av or Ave for Avenue, throughthe file MAPINFOW.ABB (located in the MapInfo program directory) which providesalternative abbreviations for common terms. If you have a lot of records which fail to geocode,this may be because they use abbreviations which are different from those used in the searchtable. You can edit MAPINFOW.ABB (it is a plain ASCII text file) to add additional terms andabbreviations as required (see MapInfo Reference page 131 and Appendix C "AdvancedGeocoding").

Where an address fails to fall within one of the ranges of address numbers listed for the street inthe search table, MapInfo will either:

• not geocode the record (Automatic mode enabled and Use the Closest AddressNumber not checked);

• give you the option of selecting an address range (if the Interactive radio button ischecked);

• geocode it to the nearest address in an existing range (Use the Closest AddressNumber checked).

MapInfo allocates addresses proportionally along each street segment (each street generallyconsists of multiple segments/blocks) leaving a short length unused at either end. Points arepositioned a fixed distance of one metre back from the edge of the street segment. Streetintersections are identified by &&, for example Broadway&&City Rd is located at theintersection between these two streets.

8 If several objects fall within one polygon, however, they will all end up at the same position, which can result in amisleading map with far fewer objects shown than actually exist. MapInfo comes with a MapBasic programDISPERSE.MBX which will randomly or systematically distribute points which land up on the same location. See page248 for instructions on using MapBasic programs.

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

4

9 StreetInfo files consist of one file of tabular data only, containing street names, joined to a table recording streetsegments with the address range of the segment attached as tabular data. Multiple segments are joined to a single streetname record using a shared reference code.

10 MapInfo Corporation also sells a more sophisticated geocoding program called MapMarker for applications whereMapInfo's geocoding proves inadequate.

Getting data files into (and out of) MapInfo

Page 21: Getting data files into (and out of) MapInfoheuristscholar.org/APPLICATIONS/understanding_mapinfo/Chapter 4.pdf · 51 4 Getting data files into (and out of) MapInfo AAAA A AAA A AAA

71

Refining geocoding with boundaries

Since the same address or locality name can repeat in more than one suburb, in different townsor in different administrative areas, MapInfo provides the ability to refine the search using anadditional table which gives the boundaries of towns, local government areas, counties etc.MapInfo can then match the record to be geocoded with the address or locality name which fallswithin the same boundary. For example:

In this example, MapInfo will geocode monuments to the position of a corresponding placename, but only if the geocode location is within the boundary of the map object in the Cnty-Bndtable which shares the same value of the County field.

? No fields will be shown under Boundary Column until a table and fields have been selected inthe Optional section.

Checking Use a Match Found in a Different Boundary in the Geocode Options dialogueallows the boundary search to be overridden where one, and only one, match is found, but thematch does not fall within the boundary indicated. This is useful where the boundary names inthe table being geocoded are not fully standardised - for example, an address may be given inone suburb when in fact it lies just across the boundary in the next suburb (or because theowners are trying to increase their market value!); LGA names may change; differentorganisations may use different names for the same area.

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

4Getting data files into (and out of) MapInfo

Page 22: Getting data files into (and out of) MapInfoheuristscholar.org/APPLICATIONS/understanding_mapinfo/Chapter 4.pdf · 51 4 Getting data files into (and out of) MapInfo AAAA A AAA A AAA

72

Geocoding options

The Options button brings up an additional dialogue, allowing refinement of the geocodingsearch:

The status of the geocoding operation for each record can be written into a numeric fieldselected from the Put Result Code in Column pulldown list. Only numeric fields will beshown. The result code is a numerical code describing the steps taken, and errors encountered,in trying to geocode that particular record - see MapInfo Reference pages 471 - 472 for themeaning of result codes.

Selecting a field in Display Additional Column refines the matching in Interactive mode (seediscussion under Find dialogue, pages 102 - 105) allowing use of a boundary to distinguish thesame name in different boundaries (towns, administrative areas, catchments etc.):

The dialogue displays a list of potential matching names within the boundary identified by theboundary column (County in this case).

The check boxes under When an exact match cannot be found are discussed on page 105.

Geocoding can also be carried out on a temporary table created by an SQL query (chapter 7).Because temporary tables are dynamically linked to the base table from which they are derived,creation of map objects in the temporary table will attach those objects to the base tablespecified as the first table in the From Tables clause of the query.

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

4Getting data files into (and out of) MapInfo

Page 23: Getting data files into (and out of) MapInfoheuristscholar.org/APPLICATIONS/understanding_mapinfo/Chapter 4.pdf · 51 4 Getting data files into (and out of) MapInfo AAAA A AAA A AAA

73

GETTING DATA OUT OF MAPINFO

Data can be exported from temporary tables (selections, tables with computed fields) as well asfrom tables which are permanently stored on disk, using Table>Export. This allows MapInfoto be used to create new data (including data derived from spatial operations)11 and export thisnew data to programs which might not be capable of such operations (such as conventionaldatabase management systems) or to save temporary data as permanent tables on disk.

Select the export format from the File Format pulldown list. The default format is MapInfoInterchange Format (MIF/MID).

Both the map objects and the attached tabular data can be exported (if the export formataccommodates map data - MapInfo MIF/MID and DXF), or the tabular data alone can beexported to common data exchange formats (DBF and ASCII delimited).

! If you cancel an export operation part way through, you will get an output file which appearsOK but only contains part of your data.

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

4

11 For example, determining polygon attribution of point objects (e.g. attribution of sites to National Park or administrativeauthority, area or perimeter of polygons, length of polylines, proportion of overlap between different classes of feature.

Getting data files into (and out of) MapInfo

Page 24: Getting data files into (and out of) MapInfoheuristscholar.org/APPLICATIONS/understanding_mapinfo/Chapter 4.pdf · 51 4 Getting data files into (and out of) MapInfo AAAA A AAA A AAA

74

TABULAR + MAP DATA

MapInfo Interchange Format (MIF/MID)

MapInfo Interchange Format is the default export format for Table>Export, and the one whichwill carry with it a maximum amount of information from the table, including projection, fielddefinitions, pen assignments, map objects and tabular data. It is a fairly straightforward ASCIIformat (see pages 58 - 62) which lends itself to tinkering with a wordprocessor or simple filterprogram.

Drawing Exchange Format (DXF)

A MapInfo table, permanent or temporary, can also be exported to an AutoCAD version 12 or13 standard DXF file (MapInfo Reference pages 119 - 120). Since only a single table isexported at a time, only one DXF layer is created, called "0".

Multi-polygon region objects are normally output as DXF blocks, but can be output as separateobjects if the check mark is removed from Preserve Multi Polygon Regions as DXF Blocks.

If the Preserve Attribute Data box is checked, both map objects and tabular data are exported,otherwise only the map objects are exported.

Click the Set Transformation button to set the transformation between the coordinate systemused within MapInfo and the coordinate system you want used in the DXF file (page 63).

If you try and export a non-mappable table to DXF, MapInfo displays the Export Table to Filedialogue but nothing happens when you click the Export button. You will get a warningmessage only once you click Cancel.

?

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

4Getting data files into (and out of) MapInfo

Page 25: Getting data files into (and out of) MapInfoheuristscholar.org/APPLICATIONS/understanding_mapinfo/Chapter 4.pdf · 51 4 Getting data files into (and out of) MapInfo AAAA A AAA A AAA

75

Coordinate system

? When exporting, coordinates are output in the native projection of the table, e.g. longitude andlatitude in degrees for a longitude/latitude projection or metre grid references relative to theselected zone for a UTM projection. The coordinates are not affected by the current projectionin which maps are displayed.

h To output coordinates in a different projection, you will first need to save a copy of the tableusing File>Save Copy As, changing the projection of the copy (Projection button below) andexport from the copy:

Note also that changing the projection12 will not change the coordinates in the tabular data. Tochange these you must first save a copy of the table in the new projection, as noted above, thenuse Table>Update Column to set the X and Y values in the tabular data to CentroidX(obj)and CentroidY(obj) respectively.

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

4

12 X and Y coordinates in the tabular data are also not updated when a map object is moved - there is no formal linkbetween the position of the map object and any particular fields in the tabular data. The link is only establishedtemporarily by Table>Create Points for the purpose of positioning points to represent the tabular data records.

Getting data files into (and out of) MapInfo

Page 26: Getting data files into (and out of) MapInfoheuristscholar.org/APPLICATIONS/understanding_mapinfo/Chapter 4.pdf · 51 4 Getting data files into (and out of) MapInfo AAAA A AAA A AAA

76

TABULAR DATA ONLY

DBase DBF and ASCII Delimited

MapInfo can also export data as DBase DBF and delimited ASCII files through Table>Export.However, only tabular data can be exported in these formats, as they have no provision formap objects. Default extensions are .DBF for DBase and .TXT for delimited ASCII. Fieldnames and types are maintained automatically for DBase. Field names can be output as the firstline of ASCII delimited files if Use First Line for Column Titles is checked:

!

Data exported in ASCII delimited format can be read by most programs. The field names canoften be picked up by the destination program from the first line of the file.

File>Save Copy As can also be used to write tabular data to DBase format, but this will createunnecessary map data files (if map objects exist in the table being saved). Table>Export istherefore recommended where the only purpose is to export the tabular data.

In cases where the tabular data will frequently be accessed by other programs, you should storethe table in DBase format, allowing direct access by both MapInfo and other software.

h

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

4Getting data files into (and out of) MapInfo