[gdal-dev] Errors while creating sozip zarr file

Scott public at postholer.com
Sat Jul 19 09:11:14 PDT 2025


Hey Orik,

If I remember correctly, it's only for gpkg, fgb or shp formats. Other 
than that the docs show a 'validate' switch which is more robust than 
the 'light' validation that is done.

Scott

On 7/19/25 08:44, Erik Schnetter via gdal-dev wrote:
> I am using GDAL to create a multidimensional zarr file that is sozip 
> compressed. I see this error when creating the file:
> 
> ERROR 1: dish_positions.00000000.zarr/zarr.json already exists in ZIP file
> ERROR 8: Open file /vsizip/data/fengine_init_pathfinder/ 
> cx66_dish_positions.00000000.zarr.zip/dish_positions.00000000.zarr/ 
> zarr.json to write failed
> 
> Everything is working fine when I do not use sozip compression. I enable 
> sozip compression by adding a "/vsizip" prefix to the file name. 
> Although there is an error reported on screen, I do not see an error 
> code reported by the function creating or closing the multidimensional 
> dataset. The resulting file ("*.zarr.zip") is created fine and looks 
> almost correct, but all attributes seem to be missing.
> 
> I wonder – is it actually possible to create a zarr file that is sozip 
> compressed, given that zarr probably writes to each of its file multiple 
> times? If not, what is the preferred way to create a sozip-compressed 
> zarr file efficiently?
> 
> Some details:
> 
> I create the dataset (i.e. the file) via
> 
>                  const auto driver_manager = GetGDALDriverManager();
>                  const auto driver = driver_manager- 
>  >GetDriverByName("Zarr");
>                  const auto dataset = 
> std::unique_ptr<GDALDataset>(driver->CreateMultiDimensional(
>                      full_path.c_str(), root_group_options_c.data(), 
> options_c.data()));
> 
> where "full_path" is "/vsizip/data/fengine_init_pathfinder/ 
> cx66_dish_positions.00000000.zarr.zip/dish_positions.00000000.zarr".
> 
> I then create multiple attributes ("CreateAttribute") and then
> 
>                  const auto mdarray = group->CreateMDArray(meta- 
>  >get_name(), dimensions, datatype,
>                                                            
> array_options_c.data());
>                      const bool success = mdarray->Write(
>                          arrayStart.data(), count.data(), nullptr, 
> bufferStride.data(), datatype,
>                          frame + datatypesize * meta->offset, frame, 
> buffer->frame_size);
> 
> and finish with
> 
>                  const CPLErr err = dataset->Close();
>                  assert(!err);
> 
> The full code is available at <https://github.com/kotekan/kotekan/blob/ 
> eschnett/updates-2/lib/stages/gdalFileWrite.cpp <https://github.com/ 
> kotekan/kotekan/blob/eschnett/updates-2/lib/stages/gdalFileWrite.cpp>>.
> 
> -erik
> 
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/gdal-dev



More information about the gdal-dev mailing list