2

I want to convert a tab file created with MapInfo to an ESRI Shapefile (.shp) using ogr2ogr in command line.

I did the following

ogr2ogr -f 'ESRI Shapefile' "file.shp" "file.tab" 

but it gives an error:

Unable to open datasource `file.tab' with the following drivers. 

I use gdalv2.4

Do I have to specify anything else?

1
  • 3
    did you try: ogr2ogr -f "ESRI Shapefile" file.shp file.tab i think the problem is because you are mixing " and '. the filenames don't need to be in quotes were as the file type option -f has to be. Commented Jun 26, 2019 at 17:24

2 Answers 2

6

The following both commands should work with double quotes "" surrounding the file format "ESRI Shapefile" and with or without double quotes "" surrounding the files names:

ogr2ogr -f "ESRI Shapefile" "file.shp" "file.tab" 

Or

ogr2ogr -f "ESRI Shapefile" file.shp file.tab 

But using single quotes '' surrounding the file format 'ESRI Shapefile' will raise an error:

Unable to open datasource `file.shp' with the following drivers (in my case). 
1

Not sure if you got this working but the easiest way is to use QGIS which is essentially a GUI for ogr2ogr. If you load in your .TAB file into QGIS you can right click in the layers panel and click

Export > Save Features As..

From here you can select a number of formats to save as.

Chris

1
  • True, but OP might be trying to run the conversion programatically. Commented Nov 14, 2022 at 17:11

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.