I'm about to start a big project converting 25,000 MapInfo files to File Geodatabase. I'm using FME to process the files. I want FME to search all files in a directory (and subdirectories). When FME encounters a TAB file which references a raster, I get the following error:

TAB files referencing raster data cannot be read through the MapInfo reader. Instead, use an appropriate raster reader. Error fetching dynamic schema definitions from reader `MAPINFO_1'.

Is there some sort of format attribute for MapInfo files which will identify TAB files which contain geometry and which ones reference Rasters? I would also like to identify TAB files which reference Excel files or Databases.

I could try skipping these by ignoring failed readers,

enter image description here

but I want to be able to list the TAB files that I'm skipping and store those in a spreadsheet or text file.

  • 1
    If you instead use "an appropriate raster reader", one would assume that it would give the same error for vector TAB files? So a second loop which processes only rasters might solve that half of the problem. – Martin Dec 6 '13 at 6:57
  • @Martin, good point. I'll try that on Monday when I'm back at work. – Fezter Dec 6 '13 at 10:28

Is there a way to look in body of TAB file and search Definition Table for TYPE parameter ?

!version 300
!charset WindowsLatin1

Definition Table
  File "example.jpg"
  Type "RASTER"

other types are

Type NATIVE Charset "WindowsLatin1"
Type LINKED Charset "WindowsLatin2"  '(database linked table)
Type ODBC                            '(database 'live' table)
Type ASCII Delimiter 09 Titles Charset "WindowsLatin1"
Type XLS Titles Range "Sheet1"
Type WKS Titles
Type ACCESS TABLE "rdatbln_line" Charset "WindowsLatin1"

There's some detailed explanation : http://georezo.net/jparis/mb_r/doc/Tab_file_format/tab_file_format.htm

| improve this answer | |
  • This is a good idea, and I ended up modifying it to come up with a solution. Thanks. – Fezter Dec 11 '13 at 5:03

I came up with a relatively inelegant solution but it works. I'm certain there is a more efficient way to do this, but I have neither the time nor the patience to seek it out.

My solution takes @sys49152's suggestion of reading an entire folder (and subfolders) of TAB files using the Text File reader. This allows me to search all the TAB files as a text file and search for either "Type" or "TYPE" which declares the different MapInfo types. I also noticed that this declaration is not always on the same line. Usually on line 6 for NATIVE types, but sometimes line 7 for rasters and occasionally on line 9.

So, I have brought in the files, trimmed the whitespace at the beginning of the line, extracted the first four characters, tested that those four characters contain either "Type" or "TYPE" and also are on line 6-9. I also exclude lines which contain field declarations because sometimes a field could be called "Type". I also split the text into a list and extract the list index that contains the table type.

enter image description here

Then I clean up the attributes and write the results to an Excel file.

enter image description here

The next problem I had was to only convert those files which were NATIVE. The solution for that to bring in a MapInfo reader which read the same folder as the text files. I filtered the text files using a TestFilter transformer and merged the results to the MapInfo files. The results could then be converted to a File Geodatabase.

enter image description here

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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