Monday, 19 October 2015

mapinfo - Merging multiple .tab files?


I was wondering if there was a quick way to merge multiple .tab files together? I have about 100.



Would appending one tab to another with the MapBasic window open, then changing the name of the table appended to TableInfo(1,1) work?



Answer



If you don't want to use MapBasic (although there is really no reason you couldn't I just can't write the code off the top of my head) you can use OGR2OGR - a handy tool for any GIS pro to have in their toolkit.


There is a good start here http://gis-programming.com/?p=194 on the details of the code snippet below.


You can do something like this in a batch file:


for %f in (*.tab) do (
ogr2ogr -update -append merge.tab %f -f “MapInfo File” -nln merge )

Loop over all the TAB files in the current folder and append to the merge.tab file


Note: If the above doesn't work try this:



for %f in (*.tab) do (
ogr2ogr -update -append merge.shp %f -f “esri shapefile” -nln merge )
ogr2ogr merge.tab merge.shp -f "MapInfo File"

No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...