2

I'm trying to use FeatureClassToFeatureClass_conversion() to convert tab files to shapefiles. When I run the code below (no errors reported) it prints the list of all tab files in the workspace like this.

C:/temp1\circle.tab
C:/temp1\square.tab
C:/temp1\triangle.tab

import arcpy 
from arcpy import env
import os

path = "C:/temp1"
  for root, dirs, files in os.walk(path,topdown=False):
    for file in files:
      if file.endswith(".TAB"):
         tablist = os.path.join(root, file)
         print(tablist)
         **#Unsure what to put here next to add the tab files above into a feature class/layer** 

Since FeatureClassToFeatureClass_conversion() requires an input feature class or layer, how can I add the list of tab files above into a feature class/layer so FeatureClassToFeatureClass_conversion() can run?

2

As long as you have a Data Interoperability license available you should be able to use something like:

arcpy.FeatureClassToFeatureClass_conversion(
                    tablist,inputFileGDB,fcName)
  • inputFileGDB is the file geodatabase you want the feature classes to be created in.
  • fcName is the name of the feature class to be created.
  • tablist is the name of the TAB file, although for readability I would name it tabFile rather than tablist because it is not a list.
| improve this answer | |
  • In ArcGIS, with data interoperability extension, TAB files appear as Feature Datasets, since TAB file can contain all sorts of geometries as well as just tabular information. OP should pick the right geometry type to be able to process them via FeatureClassToFeatureClass_conversion. This also might be the source of "tablist" confusion. – fatih_dur Sep 12 '16 at 14:12
1

I'm not sure if.tab files are supported with this feature.. I found fwtools/ogr2ogr to be a very good alternative for batch converting .tab to .shp

| 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.