Opened 10 years ago
Closed 8 years ago
#5141 closed defect (fixed)
OGR does not open MapInfo MIF with no MID
Reported by: | lpinner | Owned by: | warmerdam |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | OGR_SF | Version: | 1.10.0 |
Severity: | normal | Keywords: | mitab |
Cc: | Daniel Morissette |
Description
The MapInfo MIF format specification (http://resource.mapinfo.com/static/files/document/1074660800077/interchange_file.pdf) states that the .mid file is optional (last line in spec).
OGR fails to open a MapInfo MIF with no associated MID file.
Attachments (1)
Change History (12)
by , 10 years ago
comment:1 by , 10 years ago
Cc: | added |
---|---|
Component: | default → OGR_SF |
Keywords: | mitab added |
Milestone: | → 2.0 |
r26120 "MITAB: support reading MIF file with no associated MID file (when MIF file advertizes 'Columns 0') (#5141)"
For upstream: MITAB ticket filed at http://bugzilla.maptools.org/show_bug.cgi?id=2446 with the patch
comment:3 by , 9 years ago
This decision (only check "Columns 0") doesn't meet the specification. Columns in MIF file can contain any value. But when there is no MID file, all fields are blank.
comment:4 by , 9 years ago
Confused by your comment. The "Columns XXX" line indicate the number of columns (page 9 / 681 of http://resource.mapinfo.com/static/files/document/1074660800077/interchange_file.pdf. So when XXX = 0, no need to look for a .mid file. Do you have examples where the implementation doesn't work ?
comment:5 by , 9 years ago
I agree that "Columns XXX" indicates number of columns. But even Columns value isn't zero corresponding MID-file is optional. In this case all fields have to be considered as empty. About it it is written in last line in specification. The simplest way to check - load such MIF-file to MapInfo.
comment:6 by , 9 years ago
By reading the specification I interpret it like oleinik. If MID file is missing then MIF file should be used as if it had "Columns 0".
Meanwhile that's a good workaround to know: If you have lost the MID file, edit MIF so that it has "Columns 0" and magically GDAL finds what can be found instead of throwing an error.
comment:7 by , 9 years ago
Given that this is what the spec says and that this behavior has been confirmed in MapInfo, then I agree that in the absence of a MID file we should still open the dataset, and if columns > 0 then we still create the fields and their values should be left blank. Now, we still need someone to implement the fix.
comment:8 by , 8 years ago
I think mitab_miffile.cpp needs to be appended only one condition to implement this.
Current text:
if (m_poMIDFile->Open(pszTmpFname, pszAccess) !=0) { if (!bTestOpenNoError) CPLError(CE_Failure, CPLE_NotSupported, "Unable to open %s.", pszTmpFname); else CPLErrorReset(); CPLFree(pszTmpFname); Close(); return -1; }
Changed text:
if (m_poMIDFile->Open(pszTmpFname, pszAccess) !=0) { if (m_eAccessMode == TABWrite) { if (!bTestOpenNoError) CPLError(CE_Failure, CPLE_NotSupported, "Unable to open %s.", pszTmpFname); else CPLErrorReset(); CPLFree(pszTmpFname); Close(); return -1; } else { delete m_poMIDFile; m_poMIDFile = NULL; } }
Unfortunatelly I can't test it myself. I use compiled windows binaries from http://www.gisinternals.com/query.html?content=filelist&file=release-1600-gdal-mapserver.zip
Anybody can check this solution ?
comment:9 by , 8 years ago
comment:11 by , 8 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Batch closing of MITAB tickets fixed in GDAL. They were kept open because not merged into MITAB separate repository, but the latter one is inactive, so let's close them definitely.
MIF with no MID