Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: write_dataframe to GPKG with an "fid" column gives an error if use_arrow=True #510

Closed
Tracked by #392
theroggy opened this issue Dec 19, 2024 · 0 comments · Fixed by #511
Closed
Tracked by #392

BUG: write_dataframe to GPKG with an "fid" column gives an error if use_arrow=True #510

theroggy opened this issue Dec 19, 2024 · 0 comments · Fixed by #511
Assignees
Labels
bug Something isn't working

Comments

@theroggy
Copy link
Member

theroggy commented Dec 19, 2024

For some file types it is possible to write "custom" FID's by including an appropriate column in the input dataset, e.g. a column "fid" for GeoPackage.

However, when this is applied using write_dataframe with use_arrow=True this error is thrown: Inconsistent values of FID and field of same name.

An issue for this was opened upstream in GDAL: OSGeo/gdal#11527

EDIT: the conclusions of the upstream issue was that:

  1. there was a bug that lead to the error, which is now fixed
  2. in pyogrio, the case when there is an "fid" column present isn't handled really well. For formats that explicitly store the FID (e.g. GPKG) columns with the "correct" names (e.g. "fid" for GPKG) are automatically used by GDAL for the FID field. But, in pyogrio, these columns are also added as an ordinary column, which is redundant. The double use of the column is also what triggers the bug in GDAL mentioned in 1., so if this behaviour is changed, the bug isn't triggered anymore: BUG: fix writing fids to e.g. GPKG file with use_arrow #511

Originally noticed in geofileops/geofileops#392

@theroggy theroggy added bug Something isn't working upstream issue The bug is cause by an upstream issue and removed upstream issue The bug is cause by an upstream issue labels Dec 20, 2024
@theroggy theroggy self-assigned this Dec 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant