I am trying to import a GDB file database table and convert it to a (Pandas) dataframe. I have been trying to do so using GeoPandas and Fiona. The problem is however that not all columns are being read, and I am not sure why not. I use the following simple code to read the file:
gdbfile = gdp.read_file("path_to_gdb", driver='FileGDB')
Alternatively, I've also used fiona.open() with the same arguments. These two methods do return all of the rows, but do not however return all columns. The 'objectid' column is not read, which I know is in there (when I open the same GDB database table using QGIS, it is included). When I print the GDB database-file's schema with Fiona, it returns:
{'properties': OrderedDict([('CAT_GEWASCATEGORIE', 'str:60'),
('GWS_GEWASCODE', 'str:10'),
('GEOMETRIE_Length', 'float'),
('GEOMETRIE_Area', 'float'),
('GWS_GEWAS', 'str:255')]),
'geometry': 'MultiPolygon'}
and as you can see, 'objectid' is not in it. But when I print gdb.next() using Fiona, it includes 'id' (which content-wise is equal to the objectid):
{'type': 'Feature',
'id': '1526148', <--the 'objectid'
'properties': OrderedDict([('CAT_GWS', 'Grassland'),
('CODE', '265'),
('GEOM_Length', 1362.792),
('GEOM_Area', 10739.457),
('CROP', 'Grass')]),
'geometry': {'type': 'MultiPolygon',
'coordinates': [[[(109397.83300000057, 439262.45899999887),
(109396.84699999914, 439271.9699999988),
(109396.09099999815, 439287.80900000036),
]]]}} #I've shortened the poly
When I transform the Fiona's object into a data frame, it is not included. Does anyone know how I can include 'objectid' in the data using GeoPandas (or Fiona)? I've been trying and searching, but can't find anything on this problem with reading GDB database tables. I've been trying to include the 'id' in the schema argument of fiona.open() but that didn't work for me either (though perhaps I did it wrong, I used the schema below and it seemingly ignored it and kept the old schema). I am new to the GDB database filetype.
{'type': 'str:10',
'id': 'int',
'properties': {('CAT_GWS', 'str:60'),
('CODE', 'str:10'),
('GEOM_Length', 'float'),
('GEOM_Area', 'float'),
('CROP', 'str:255')},
'geometry': 'MultiPolygon'}
ogr2ogr C:\GIS\data\datacopy.gpkg C:\GIS\data\data.fgdb
)