You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Instead of writing a triplet property, I get the following exception:
Warning 6: dataset /Users/egor/Documents/reach-surveying/surveying/gdf.geojson does not support layer creation option ENCODING
Traceback (most recent call last):
File "project.py", line 118, in <module>
gdf.to_file("gdf.geojson", driver="GeoJSON")
File "/Users/egor/Documents/reach-surveying/venv/lib/python2.7/site-packages/geopandas/geodataframe.py", line 343, in to_file
to_file(self, filename, driver, schema, **kwargs)
File "/Users/egor/Documents/reach-surveying/venv/lib/python2.7/site-packages/geopandas/io/file.py", line 63, in to_file
c.write(feature)
File "/Users/egor/Documents/reach-surveying/venv/lib/python2.7/site-packages/fiona/collection.py", line 339, in write
self.writerecords([record])
File "/Users/egor/Documents/reach-surveying/venv/lib/python2.7/site-packages/fiona/collection.py", line 333, in writerecords
self.session.writerecs(records, self)
File "fiona/ogrext.pyx", line 1019, in fiona.ogrext.WritingSession.writerecs (fiona/ogrext2.c:17895)
File "fiona/ogrext.pyx", line 326, in fiona.ogrext.OGRFeatureBuilder.build (fiona/ogrext2.c:7195)
ValueError: Invalid field type <type 'tuple'>
I can see this data type is not supported, nor the lists are mentioned in FIELD_TYPES_MAP and FIELD_TYPES. Is there a potential way to work around this problem?
@egorf you are right, there is currenty no support in Fiona for tuple or list properties. The work arounds are to explode these tuples into three separate properties or to encode them in a string using a microformat specific to your application.
The blocker for Fiona is that the GDAL/OGR libraries lack support for arbitrary Python collections. In the list at http://www.gdal.org/ogr__core_8h.html#a787194bea637faf12d61643124a7c9fc you'll see there is no support for dicts or heterogeneous lists or tuples, only array-like lists. Supporting arrays of a single element type would not be very hard, though we might find that they are not supported in certain data formats.
Ok, I see. Theoretically, there may be check, that all data inside the list is the right type, then create an OFTList, raise ValueError otherwise. I will look into this
Expected behavior and actual behavior.
Instead of writing a triplet property, I get the following exception:
I can see this data type is not supported, nor the lists are mentioned in
FIELD_TYPES_MAP
andFIELD_TYPES
. Is there a potential way to work around this problem?Steps to reproduce the problem.
Operating system
Mac OS X 10.12.3
Fiona version and provenance
Fiona==1.7.5, installed as a pip dependency to geopandas
The text was updated successfully, but these errors were encountered: