[Gdal-dev] MapInfo Tab Merger

Daniel Morissette dmorissette at mapgears.com
Tue Nov 28 12:46:53 EST 2006

Unfortunately the .TAB driver in OGR doesn't support appending data to 
existing files, so you have to write the whole output file in a single 
pass... and I don't think ogr2ogr supports multiple input layers at once 
so you'll have to do a bit of gymnastic to get the result you want.

Here are a couple of options using the MITAB library 
(http://mitab.maptools.org/) directly, which is what OGR uses under the 
hood to read/write TAB datasets. The advantage of working directly with 
MITAB in your case is that it reduces the chances of losing information 
(pen/brush styles, field types, etc) when going from one format to 
another with OGR.

1- If you can write your own little program in VB or in C then use the 
MITAB C API to write a program that reads in features from multiple 
files and copies them to a single output file. The file mitabc_test.c 
contains sample code that shows how to open files for reading and 
writing. Mapping this code to VB shouldn't be too hard either.

2- If you don't want to do any programming, then you can use the tab2tab 
program to convert all your source .tab datasets to .mif/.mid. Then 
merge all the .mid files to a single .mid file, do the same with all the 
.mif files, merging them all to a single .mif file after stripping the 
headers of all the .mif files except the first one. If you merge the 
.mid and .mif files in the same order then you can convert the resulting 
.mif/.mid dataset to .tab using tab2tab and you won't have lost any 

Oh wait... now that I have written all that, there is an easier 
solution: if you can then create a seamless table in MapInfo (a virtual 
dataset that contains all your indiviual .TAB files) ... then use 
OGR2OGR to convert the seamless .TAB dataset to a single .TAB file


abhay menon wrote:
> Hello List,
> I have a dataset in MapInfo Tab  format which has multi geometry (point, 
> linestring and polygon) stored in it. I have to append multiple tab 
> files outside MapInfo since this dataset is heavy and take a lot of time 
> in processing (also the table structure for all the files are same in 
> MapInfo Tab format)
> Is there a way I can do this using OGR?
> I have tried to store this data in SQLite and then thru SQLite3.exe I 
> merge the tables into one new table but I lose the MapInfo Tab Table 
> Structure(especially the field size) in this process which is important 
> for further purpose.
> Also tried that with GML too. but it increase the number fields in data 
> structure available (FID of all the TAB's are also inserted as FIELD's) 
> and also it seem to induce some extra feature.. even thought they are 
> not visible..
> So I need that data final MapInfo TAB. Can anyone help me with this..
> -- 
> Thanks and Regards
> Abhay Menon
> ------------------------------------------------------------------------
> _______________________________________________
> Gdal-dev mailing list
> Gdal-dev at lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/gdal-dev

Daniel Morissette

More information about the Gdal-dev mailing list