I am trying to update the metadata on an already written .gdb with n layers. I would like to add the same metadata to each layer. When I read in the file and update the metadata dictionary, the added metadata is not saving.
I have reproduced below:
import geopandas as gpd
import pandas as pd
import fiona
from collections import OrderedDict
philly_layer_1 = gpd.read_file('https://opendata.arcgis.com/datasets/405ec3da942d4e20869d4e1449a2be48_0.geojson')
philly_layer_2 = philly_layer_1.copy()
philly_layer_1.to_file('test.gdb', layer = 'philly_1', driver = 'OpenFileGDB')
philly_layer_2.to_file('test.gdb', layer = 'philly_2', driver = 'OpenFileGDB')
philly_schema = {'properties': OrderedDict([('OBJECTID', 'int'),('SHAPE__AREA', 'float'),('Shape__Length', 'float')]),'geometry':'Polygon'}
df = fiona.open('test.gdb', 'w', layer=0, schema = philly_schema)
df.meta
{'driver': 'OpenFileGDB',
'schema': {'properties': OrderedDict([('OBJECTID', 'int'),
('SHAPE__AREA', 'float'),
('Shape__Length', 'float')]),
'geometry': 'Polygon'},
'crs': CRS.from_wkt(''),
'crs_wkt': ''}
When I run:
df.meta.update({'Publication Date': '2023-08-08'})
df.meta['Publication Date']
I am getting an error KeyError: 'Publication Date'
because the metadata has not actually been updated.
I am hoping to see
{'driver': 'OpenFileGDB',
'schema': {'properties': OrderedDict([('OBJECTID', 'int'),
('SHAPE__AREA', 'float'),
('Shape__Length', 'float')]),
'geometry': 'Polygon'},
'crs': CRS.from_wkt(''),
'crs_wkt': '',
'Publication Date': '2023-08-08'
}
Is there a way to update the metadata in each layer of the geodatabase using an open source library?