Open Shapefile as Viktor File object in Fiona

Paulien made a little mistake here. In her snippet, a new empty File Object is created. But in the question of OP, there is already an uploaded file available as VIKTOR file object. So no need to create a new File.

If you want to open a file in fiona from a Viktor File object, from a FileField or an FileEntity. The best way is as follows:

with shape_file.open_binary() as fp:
    with fiona.open(fp, "r") as  fiona_src:
        #.. Do something with fiona_src

Here shape_file is the VIKTOR file object from the FileField. In this example, everything is kept in memory and no files are written to the local file system (whicg can cause problems in production).

For the opposite action, see this topic.