I've basically followed the Fiona online manual verbatim to write an output file but my code crashes when I call Fiona.open() to create said output file.
Traceback reports that the reason for the crash is 'w' is not supported. How can this be?
I've assigned the source file's driver, crs, and schema into variables which are used when making the call to create an output file. I have verified that these variables are not null.
Is there something else I need to do?
This is what traceback shows:
unsupported mode: 'w'
Traceback (most recent call last):
File "/home/userid/workspace/TestScript.py", line 63, in
with fiona.open(destinationDatabaseFile, 'w', driver=source_driver, crs=source_crs, schema=source_schema) as destination:
File "/usr/lib64/python2.7/site-packages/fiona/init.py", line 176, in open
enabled_drivers=enabled_drivers, crs_wkt=crs_wkt) File "/usr/lib64/python2.7/site-packages/fiona/collection.py", line 121, in init
"unsupported mode: %r" % self.mode)
DriverError: unsupported mode: 'w'
This is my code snippet (run-time error occurs on 3rd fiona.open call):
with fiona.open(sourceDatabaseFile, 'r', layer="SomeKindaSrf") as gdb:
source_driver = gdb.driver
source_crs = gdb.crs
source_schema = gdb.schema
with fiona.open(sourceDatabaseFile, 'r', layer="AnotherKindaSrf") as gdbStructures:
with fiona.open(destinationDatabaseFile, 'w', driver=source_driver, crs=source_crs, schema=source_schema) as destination: for feature in gdb: for buildings in gdbStructures: