question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

error while saving geodataframe as mapinfo .tab file

See original GitHub issue

Hi,

I’m getting below error while exporting geopandas dataframe as mapinfo .TAB file.

Code:

import geopandas as gpd

p=r"D:\data.TAB"
testdata = gpd.read_file(p)
testdata.to_file("output.TAB", driver="MapInfo File")`
(base) D:\FTTC_Automation\Python\PC_Check\fttc_app>python test.py
Traceback (most recent call last):
  File "fiona\ogrext.pyx", line 1167, in fiona.ogrext.WritingSession.start
  File "fiona\_err.pyx", line 246, in fiona._err.exc_wrap_int
fiona._err.CPLE_AppDefinedError: IMapInfoFile::CreateField() called with unsupported field type 12. Note that Mapinfo files don't support list fiel
d types.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "test.py", line 6, in <module>
    cable.to_file("output.TAB", driver="MapInfo File")
  File "C:\ProgramData\Anaconda3\lib\site-packages\geopandas\geodataframe.py", line 413, in to_file
    to_file(self, filename, driver, schema, **kwargs)
  File "C:\ProgramData\Anaconda3\lib\site-packages\geopandas\io\file.py", line 116, in to_file
    schema=schema, **kwargs) as colxn:
  File "C:\ProgramData\Anaconda3\lib\site-packages\fiona\env.py", line 397, in wrapper
    return f(*args, **kwargs)
  File "C:\ProgramData\Anaconda3\lib\site-packages\fiona\__init__.py", line 267, in open
    **kwargs)
  File "C:\ProgramData\Anaconda3\lib\site-packages\fiona\collection.py", line 162, in __init__
    self.session.start(self, **kwargs)
  File "fiona\ogrext.pyx", line 1173, in fiona.ogrext.WritingSession.start
fiona.errors.SchemaError: IMapInfoFile::CreateField() called with unsupported field type 12. Note that Mapinfo files don't support list field types

Any help much appreciated.

Thanks in Advance, Mani

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:22 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
PeterFoghcommented, Oct 14, 2020

I have also encountered this error of saving integer columns to .TAB files with the MapInfo driver.

I found out that all integer types (int64, int32, and int16) results in the error “CPLE_AppDefinedError: IMapInfoFile::CreateField() called with unsupported field type 12. Note that Mapinfo files don’t support list field types.”

geopandas cannot save int to tab file

Currently, I use the workaround by casting the integer columns to floats.

1reaction
matthewsheerancommented, Sep 20, 2020

Its a bug or mis-informative error (using my port of ogr2ogr.c to C#). I’ve upgraded NuGet Gdal + Gdal.Native + Gdal.Plugins from 1.11.1 through 2.4.2 (where I first saw the bug) to 2.4.4 which broke my working test.

Using OSGeo4W64 produces the follow warning rather than error so I guess I will heed it and change my test data: “ogr2ogr -f “MapInfo File” tmp.tab test.shp -overwrite Warning 1: The output driver does not seem to natively support Integer64 type for field STATESP020. Converting it to Real instead. -mapFieldType can be used to control field type conversion.”

I also may have changed build from Auto/x86 to x64 which kind of makes sense: i.e. “Integer64”. So many inter-dependencies in S/W Development these days make life a nightmare (its the environment/build changes like 32-bit/x86 to 64-bit/x64 that are the worst of all with the most inscrutable error message results: you’ve got to have your wits about you!

Got another problem now with XUnit refusing to return from running some tests…

Read more comments on GitHub >

github_iconTop Results From Across the Web

error while saving geodataframe as mapinfo .tab file · Issue #748
Hi,. I'm getting below error while exporting geopandas dataframe as mapinfo .TAB file. Code: import geopandas as gpd. p=r"D:\data.TAB"
Read more >
error while saving geodataframe as mapinfo .tab file
Hi,. I'm getting below error while exporting geopandas dataframe as mapinfo .TAB file. Code: import geopandas as gpd p=r"D:\data.
Read more >
geopandas.GeoDataFrame.to_file
If not specified, it attempts to infer it from the file extension. If no extension is specified, it saves ESRI Shapefile to a...
Read more >
GeoPandas does not write CRS in MapInfo Tab
I'm trying to convert a GeoTIFF file into a MapInfo format with Python and GeoPandas. To do that, I'm using the following code:...
Read more >
Error opening .tab file - Google Groups
Hi group,. I use MapInfo v10 and am trying to open a .tab file that I have been sent. It contains the .dat,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found