geopandas / dask-geopandas

Parallel GeoPandas with Dask
https://dask-geopandas.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
486 stars 45 forks source link

FeatureError from filegdbtable.cpp when reading file #257

Closed OfirMazor closed 1 year ago

OfirMazor commented 1 year ago

Trying to read a line Feature Class from a GDB:

import pandas as pd
import geopandas as gpd
import dask_geopandas as dask_gpd

layer = dask_gpd.read_file(path    = '...my_gdb.gdb',
                           layer   = 'my_lines',
                           columns = ['col1', 'col2', 'geometry'],
                           npartitions = 16)

layer  = layer.compute()   #the error raised here

The feature class seems to be valid since it's opening in Qgis/Arcpro. When calling the compute method - the error below is raised.

FeatureError: Error occurred in C:\vcpkg\buildtrees\gdal\src\v3.6.4-c146dfdaab.clean\ogr\ogrsf_frmts\openfilegdb\filegdbtable.cpp at line 1487

This error only happens with this specific feature class, other feature classes in the same GDB are readable.

-Python 3.11 (winpython)

martinfleis commented 1 year ago

Does it work when you try to read it directly with pyogrio or Fiona? Easy way of checking that would be via geopandas.

import geopandas as gpd

gdf_fiona = gpd.read_file(path)
gdf_pyogrio = gpd.read_file(path, engine="pyogrio")

Note that FileGDB is a proprietary format and the driver in GDAL has some limitations.

OfirMazor commented 1 year ago

With Fiona as engine the Feature Class was readable ✔️ With pyogrio as engine I got the same error ❌

Anyway, I have exported the the feature class again in new GDB and that solved the problem so I guess there was something not valid in the original feature class...