I am very new in python and trying to read MapInfo (.TAB) file and convert it in to CSV format in following way:
import geopandas as gpd
input_file = 'F:/.../QGIS/sites.tab'
test = gpd.read_file(input_file, driver="MapInfo File")
output_file = 'F:/.../QGIS/new_sites_copy'
test.to_file(output_file, driver = "CSV")
The code creates the CSV file which contains only the header similar to MapInfo Tab file but no other attributes are available in csv file in respect to column heading. Below is the snip of output csv file:
And below is the error that showing after executing the code:
I have installed these modules for this purpose: numpy, pandas, shapely, gdal, fiona, pyproj, rtree, geopandas
Below are the supported drivers by geopandas (gpd.io.file.fiona.drvsupport.supported_drivers):
{'AeronavFAA': 'r', 'ARCGEN': 'r', 'BNA': 'rw', 'DXF': 'rw', 'CSV': 'raw', 'OpenFileGDB': 'r', 'ESRIJSON': 'r', 'ESRI Shapefile': 'raw', 'FlatGeobuf': 'rw', 'GeoJSON': 'raw', 'GeoJSONSeq': 'rw', 'GPKG': 'raw', 'GML': 'rw', 'OGR_GMT': 'rw', 'GPX': 'rw', 'GPSTrackMaker': 'rw', 'Idrisi': 'r', 'MapInfo File': 'raw', 'DGN': 'raw', 'PCIDSK': 'rw', 'OGR_PDS': 'r', 'S57': 'r', 'SEGY': 'r', 'SUA': 'r', 'TopoJSON': 'r'}
How do I solve this?
pyqgis
issue? this is related to geopandas. have you checked that the layer is valid? have you tried simply using ogr2ogr or load the layer in QGIS and save as CSV? – Dror Bogin Feb 15 at 10:41