-
Notifications
You must be signed in to change notification settings - Fork 216
Closed
Description
Expected behavior and actual behavior.
The GPKG format allows to also add records without spatial data, however it's not clear how this can be done in fiona. Simply ommiting the geometry field causes an error (See below). Adding a geometry field with a value of None instead adds a geometry column filled with None
Steps to reproduce the problem.
crs = fiona.crs.from_epsg(4326)
schema = {'properties': {'schema_version': 'int',
'source': 'str',
'heating_degree_days': 'float',
'cooling_degree_days': 'float'}}
data = {'properties': {'schema_version': 1,
'source': 'OneBuilding TMY',
'heating_degree_days': 3322.016666666667,
'cooling_degree_days': 6781.799999999999}}
with fiona.open("package.gpkg", 'w', driver='GPKG', crs=crs, schema=schema, layer='climate',
OVERWRITE='YES',
SPATIAL_INDEX='NO'
) as package:
package.write(data)Result
File ~/Code/geneap/.venv/dev/lib/python3.10/site-packages/fiona/collection.py:568, in Collection.write(self, record)
562 def write(self, record):
563 """Stages a record for writing to disk.
564
565 Note: Each call of this method will start and commit a
566 unique transaction with the data source.
567 """
--> 568 self.writerecords([record])
File ~/Code/geneap/.venv/dev/lib/python3.10/site-packages/fiona/collection.py:558, in Collection.writerecords(self, records)
556 if self.mode not in ("a", "w"):
557 raise OSError("collection not open for writing")
--> 558 self.session.writerecs(records, self)
559 self._len = self.session.get_length()
560 self._bounds = None
File fiona/ogrext.pyx:1396, in fiona.ogrext.WritingSession.writerecs()
AttributeError: 'dict' object has no attribute 'properties'
Fiona and GDAL version and provenance
Fiona 1.9.3 from pip, GDAL from homebrew
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels