Fiona icon indicating copy to clipboard operation
Fiona copied to clipboard

`float` as invalid field type in file geodatabase

Open gzt5142 opened this issue 1 year ago • 1 comments

I don't seem to be able to access columns of type float from file geodatabases. Layers will be ingested, but the offending columns are dropped.

Expected behavior and actual behavior.

Reading a layer from within a file geodatabase:

Expected:

  • Expect all numeric columns to be included in schema.
  • Opening same geodatabase and layer using other GDAL/OGR tools (e.g. QGIS, ogrinfo) correctly read the data.

Actual:

  • Columns which have a data type of float are declared invalid as fiona reads them; they are not included in the schema.

The fiona warning message claims that a data type of (2, 3) is invalid. The way I read https://github.com/Toblerity/Fiona/blob/main/fiona/gdal.pxi#L228, that maps to OFTReal/OFSTFloat32. If I've understood that correctly, fiona is rejecting float32 data types due to there not being a mapping in OGRPropertyGetter for this type.

Steps to reproduce the problem.

  • Create file geodatabase with ArcGIS Pro (sample gdb is attached to this issue)
  • Add feature class with at least one column of type float
  • Open that gdb/layer with fiona

Attached is a simple geodatabase with two feature classes in it. One with a float column and one with a double column. The with_float32 layer does not recognize all columns.

>>> with fiona.open("test.gdb", layer="with_float32") as src:
>>>     print(src.schema)
WARNING:fiona.ogrext:Skipping field value: invalid type (2, 3)
{'properties': {}, 'geometry': 'Point'}

A similar feature class, created with value column of type double:

>>> with fiona.open("test.gdb", layer="with_double") as src:
>>>     print(src.schema)
{'properties': {'value': 'float'}, 'geometry': 'Point'}

Operating system

$ uname -a
Linux ******  #78~20.04.1-Ubuntu SMP Wed Oct 9 15:30:47 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux

Fiona and GDAL version and provenance

Fiona 1.10.1 installed via PyPi

>>> print(f"fiona version: {fiona.__version__}")
fiona version: 1.10.1

>>> print(f"GDAL release: {fiona.get_gdal_release_name()}")
GDAL release: 3.9.2

test.gdb.zip

gzt5142 avatar Dec 11 '24 21:12 gzt5142

This seems to be the result of https://github.com/Toblerity/Fiona/issues/1472 where there's not a Fiona Float type added here?

https://github.com/Toblerity/Fiona/pull/1366/files#diff-76626b3e0a07935682fcfa77d3924891b8badd5d84d98f9ae64e9e7e4b6b9cd8R74-R87

@sgillies Perhaps that's an oversight when that change was implemented?

robodair avatar Jul 14 '25 23:07 robodair