[gdal-dev] cannot write to gdal_array

Even Rouault even.rouault at spatialys.com
Fri Mar 13 08:41:42 PDT 2020


Jon,

> I'm trying to upgrade from GDAL 2.2.0 to 3.0.4 and some of our tests are
> failing. We're using gdal_array.OpenArray() to create temporary datasets
> and all the tests where we call band.WriteArray() are failing with the
> error "CPLError: Write operation not permitted on dataset opened in
> read-only mode."
> 
> I can't see any way to open a gdal_array in update mode, so is this a change
> in behaviour between 2.2 and 3.0?

A not intended one. Due to gdal_array.OpenArray() having apparently always set 
ReadOnly setting for a unknown reason, and the MEM driver used by it 
underneath that didn't honour this setting until recently.

Proposed fix queued in https://github.com/OSGeo/gdal/pull/2317

> Should we be able to write to these
> datasets, or should I change the failing tests to use the MEM driver
> instead?

If you can't apply the above fix, yes, using the MEM driver is probably your 
best option

Even

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com


More information about the gdal-dev mailing list