Skip to content

float as invalid field type in file geodatabase #1472

@gzt5142

Description

@gzt5142

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions