-
I have a function that I want to construct a Fiona Collection (from scratch) , and return that object. I read "Writing new files from scratch", but it suggests creating an actual file (e.g. a Shape file). In general, I'm starting to understand, that a Collection is a fancy file pointer (a bit like csv.writer), rather than an object that can be passed around between functions, for those functions to read/manipulate the collection. Can you please confirm that my understanding above is correct? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
There is a reason why I don't want to just write it directly to a file. I want one function to build the collection, and then there are other functions that will take care of dumping that collection to a variety of files. Of course I could just decide that it should always dump to Shape first, and then convert from that Shape file to Geopackage, etc. But that does not seem as clean as I would like it :) Anyway, having looked at this for a few days, I'm quite convinced Fiona collections are always based on an actual file. It might be possible to store such a file in memory in some kind of IO buffer, but I have not looked into that. Let me know, if there is a best practice :) |
Beta Was this translation helpful? Give feedback.
-
I actually started out using GeoJSON's FeatureCollection, but then changed to doing it entirely using Fiona's Collection, because (as far as I remember) I believed it was more clean. Until I realized that I could not work in memory. But good to know that you condone that approach :) Thanks. |
Beta Was this translation helpful? Give feedback.
I actually started out using GeoJSON's FeatureCollection, but then changed to doing it entirely using Fiona's Collection, because (as far as I remember) I believed it was more clean. Until I realized that I could not work in memory. But good to know that you condone that approach :) Thanks.