I am trying to convert a MapInfo file to an ESRI shapefile using GDAL's ogr2ogr command as described here, but I am getting the following error:

Unable to open datasource `Iceland2pts.mif' with the following drivers.
  -> ESRI Shapefile
  -> MapInfo File
  -> a bunch more drivers listed...

Just to be sure I have updated my GDAL install to the latest version (1.10.1) on Ubuntu, so I'm thinking it has to do with the format of the file (due to this), but I just don't know enough about these to know what is going wrong.

Example format of MapInfo file:

Charset "WindowsLatin1"
        -22.556955         64.777794
        -22.555510         64.782730
        -22.544556         64.779297
        -22.546009         64.777359
        -22.493431         64.767670
        -22.486217         64.774597
        -22.483826         64.772453
        -22.486826         64.768799
        -22.493431         64.767670

Does the formatting look incorrect, or is something else eschew?


Update: Example of the possible MID header

Charset "WindowsLatin1"
        -23.8252        65.7438
        -23.8289        65.7445
        -23.8355        65.7472
        -23.8421        65.7503
        -23.8477        65.7531

2 Answers 2


From the MapInfo site:

MIF/MID format is comprised of two files, one with an extension of MIF, the other with the same name, but the extension MID. The MIF file contains the actual points that represent the objects, while the MID file contains the text information about the objects.

The MapInfo MIF format specification notes that the .mid is optional, but the GDAL/OGR documentation refers to "a pair of .MIF + .MID files" and a quick test using a MIF with no MID shows that ogrinfo fails when the MID is missing.

It looks like your MIF is not supposed to have an associated MID (i.e COLUMNS 0) so it seems like this is a bug in GDAL/OGR. I've opened a ticket (and in only a few hours it's been fixed in trunk scheduled for release in GDAL 2.0).

  • Thanks Luke. I had thought that I had two different MIF files, as one had the extension .mif and the other .MIF, but perhaps this is the MID file you refer to. I will include the header of this file to my post for more info and give your suggestion a shot. Thanks for filing the bug report! Jul 1, 2013 at 14:26
  • @shootingstars no, that 2nd file is a MIF, the format specs I linked to explains the difference. MIFs have the header and geometry, MIDs have only the attributes. Your files do not have MIDs and gdal/ogr cannot open them. A workaround might be to add a dummy column, see example MIF and create a dummy MID with a dummy value for each feature in the MIF. Alternatively, checkout gdal trunk from the subversion repo and compile from source (ask a new question if you need help with that).
    – user2856
    Jul 1, 2013 at 23:59
  • Great. Thanks Luke. I'll give that a go ASAP and get back to here. Jul 4, 2013 at 16:15

I am almost certain you can't get away with COLUMN 0. You need at least 1 (dummy) field, but you can skip the MID file and it will create default values for all fields. At least, that is how MapInfo works.

  • You mean I should just make it Columns 1 rather than Columns 0? Thanks. Jul 5, 2013 at 17:32
  • 1
    Yes, COLUMNS 1 and "Dummy CHAR(1)" on the next line. Jul 6, 2013 at 10:39
  • Tried changing COLUMNS 0 to COLUMNS 1 and adding Dummy CHAR(1) in a new line below it, and I am still getting the error. I also tried "Dummy CHAR(1)", just to be sure that wasn't want you meant. Jul 9, 2013 at 11:57
  • ogr2ogr may need the MID file (MapInfo doesn't). So, try to create the MID file too with dummy values. Jul 12, 2013 at 22:31
  • COORDSYS Earth PROJECTION 1, 104 Jul 14, 2013 at 11:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.