I can get around this my importing the MIF into a TAB in MapInfo but is there a way FME can read in a MIF on its own?
I can get around this my importing the MIF into a TAB in MapInfo but is there a way FME can read in a MIF on its own?
Reviving this old question for users looking for an answer to the same issue.
FME will expect a .mif to have a corresponding .mid file as a logical MIF file consists of both files. In addition to the method mentioned in the questions above (import MIF into TAB in MapInfo), there are two workarounds you can try.
Method 1. Create a dummy .mid file. You will have to know (or find or guess) the number of features in the MIF file. Use a Creator to create the same number of features and write a .mid with the same name as the .mif file using the Text File writer. You can now read the .mif file using the MIF/MID reader successfully.
If the number of lines in your .mid file is lower than the number of features in the .mif file, features without a corresponding attribute in the .mid file will not be read. It does not seem to matter if the number of lines in your .mid file is higher than the number of features in the .mif file.
Method 2. Read the .mif file using Text File reader. MIF is an ASCII-based format so it can be read as a text file. Construct geometry from the coordinate pairs (this tutorial may contain helpful starting points: https://knowledge.safe.com/articles/56486/converting-from-csv-data-2.html).
If you require Coordinate System information, use the CoordinateSystemDescriptionConverter to convert the MapInfo string to FME Representation. Use this information in the CoordinateSystemSetter.
Reviving this old question for users looking for an answer to the same issue.
FME will expect a .mif to have a corresponding .mid file as a logical MIF file consists of both files. In addition to the method mentioned in the questions above (import MIF into TAB in MapInfo), there are two workarounds you can try.
Method 1. Create a dummy .mid file. You will have to know (or find or guess) the number of features in the MIF file. Use a Creator to create the same number of features and write a .mid with the same name as the .mif file using the Text File writer. You can now read the .mif file using the MIF/MID reader successfully.
If the number of lines in your .mid file is lower than the number of features in the .mif file, features without a corresponding attribute in the .mid file will not be read. It does not seem to matter if the number of lines in your .mid file is higher than the number of features in the .mif file.
Method 2. Read the .mif file using Text File reader. MIF is an ASCII-based format so it can be read as a text file. Construct geometry from the coordinate pairs (this tutorial may contain helpful starting points: https://knowledge.safe.com/articles/56486/converting-from-csv-data-2.html).
If you require Coordinate System information, use the CoordinateSystemDescriptionConverter to convert the MapInfo string to FME Representation. Use this information in the CoordinateSystemSetter.
But the idea of using FME to read the MIF file as a text file, creating a companion MID file (using FeatureWriter), and finally reading the MIF/MID pair (using FeatureReader) is an interesting one, and very plausible and doable. Kudos to Debbie :-)
But the idea of using FME to read the MIF file as a text file, creating a companion MID file (using FeatureWriter), and finally reading the MIF/MID pair (using FeatureReader) is an interesting one, and very plausible and doable. Kudos to Debbie :-)
You do make a good point about the MIF file header. It would definitely be wise to explore the .mif file using a text editor before implementing either method.
Just one note, you can use both methods but it is not necessary. Either one should do the trick. I realise my answer was a bit ambiguous about this point so I've edited it for greater clarity.