[Qgis-user] Fwd: Importing Mapinfo Layers

Daniel Morissette dmorissette at mapgears.com
Thu Aug 5 12:12:10 EDT 2010

Brett Adams wrote:
> Having some issues importing certain MapInfo layers. I've attached the
> file in question if that helps.
> Realise I can simply import the txt file, but I have hundreds of these
> files so I'm not keen on that idea.
> Currently running Version 1.4.0

I had a look at your dataset, it is a TAB file which uses a CSV file for
the attributes and the MITAB driver in OGR doesn't currently support
that case (it's the first time I hear of this combination in over 10
years of existence of the MITAB driver).

The long term fix would be to implement support for this table type in
OGR/MITAB. I have created a MITAB ticket to that effect at
(note that this is unlikely to be implemented until either I have some
spare time or someone comes up with funding... if you are interested you
can contact me off-list)

In the meantime, you can write a script that uses the "ogr2ogr" utility
to modify your datasets to use a DBF file for the attributes which is
supported by the OGR/MITAB driver.

First you need to rename the .txt file to .csv so that OGR recognizes
it, and then use the following ogr2ogr command to convert the .csv to DBF:

  mv Rt_1998.txt Rt_1998.csv
  ogr2ogr Rt_1998.dbf Rt_1998.csv Rt_1998

Then you need to edit Rt_1998.TAB and change the "TYPE ASCII ..." line
to "TYPE DBF". The resulting file will look like this:

!version 300
!charset WindowsLatin1

Definition Table
!  Type ASCII Delimiter "," Titles Charset "WindowsLatin1"
  Type DBF
  Fields 6
    X_AGD84 Float ;
    Y_AGD84 Float ;
    Line Integer ;
    Stn Float ;
    SURVEY Char (9) ;
    AUTHOR Char (3) ;

In the above example the TYPE ASCII line only commented out, but you can
remove it too. The modified dataset works for me with OGR and should
work in QGIS too (since it uses OGR to read TAB files).

If you have several files to process it should be possible to write a
script to automate these steps.

Daniel Morissette

More information about the Qgis-user mailing list