[gdal-dev] cannot write to gdal_array

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[gdal-dev] cannot write to gdal_array

Jon Morris

Hello all,

 

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? Should we be able to write to these datasets, or should I change the failing tests to use the MEM driver instead?

 

Thanks,

 

Jon

 

Jon Morris

Software Developer

 

<a href="sip:jon.morris@jbarisk.com">Skype

 

T +44 (0) 1756 799919
www.jbarisk.com

Visit our website  Follow us on Twitter

Our postal address and registered office is JBA Risk Management Limited, 1 Broughton Park, Old Lane North, Broughton, Skipton, North Yorkshire BD23 3FD.

Find out more about us here: www.jbarisk.com and follow us on Twitter @JBARisk and LinkedIn

The JBA Group supports the JBA Trust.

All JBA Risk Management's email messages contain confidential information and are intended only for the individual(s) named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail.
Please notify the sender immediately by email if you have received this email by mistake and delete this email from your system.
 

JBA Risk Management Limited is registered in England, company number 07732946, 1 Broughton Park, Old Lane North, Broughton, Skipton, North Yorkshire, BD23 3FD, Telephone: +441756799919

 


_______________________________________________
gdal-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/gdal-dev
Reply | Threaded
Open this post in threaded view
|

Re: cannot write to gdal_array

Even Rouault-2
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
_______________________________________________
gdal-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/gdal-dev
Reply | Threaded
Open this post in threaded view
|

Re: cannot write to gdal_array

Jon Morris
Thanks for the quick fix, Even! Glad it wasn't just something I'd missed.

I'm not entirely clear on the uses for gdal_array. Are there cases where it is better than using a MEM raster? Is there any more detailed documentation?

Thanks,

Jon

-----Original Message-----
From: Even Rouault <[hidden email]>
Sent: 13 March 2020 15:42
To: [hidden email]
Cc: Jon Morris <[hidden email]>
Subject: Re: [gdal-dev] cannot write to gdal_array

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
T +44 (0) 1756 799919
www.jbarisk.com<http://www.jbarisk.com>

[Visit our website]<http://www.jbarisk.com> [http://www.jbagroup.co.uk/imgstore/JBA-Email-Sig-Icons-LINKEDIN.png] <https://www.linkedin.com/in/jon-morris-a2897b4/>  [Follow us on Twitter] <https://twitter.com/jbarisk>
Our postal address and registered office is JBA Risk Management Limited, 1 Broughton Park, Old Lane North, Broughton, Skipton, North Yorkshire BD23 3FD.
Find out more about us here: www.jbarisk.com<http://www.jbarisk.com/> and follow us on Twitter @JBARisk<http://twitter.com/JBARisk> and LinkedIn<https://www.linkedin.com/company/2370847?trk=tyah&trkInfo=clickedVertical%3Acompany%2CclickedEntityId%3A2370847%2Cidx%3A2-1-2%2CtarId%3A1447414259786%2Ctas%3AJBA%20RISK%20MANAGEMENT>

The JBA Group supports the JBA Trust.

All JBA Risk Management's email messages contain confidential information and are intended only for the individual(s) named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail.
Please notify the sender immediately by email if you have received this email by mistake and delete this email from your system.


JBA Risk Management Limited is registered in England, company number 07732946, 1 Broughton Park, Old Lane North, Broughton, Skipton, North Yorkshire, BD23 3FD, Telephone: +441756799919


_______________________________________________
gdal-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/gdal-dev
Reply | Threaded
Open this post in threaded view
|

Re: cannot write to gdal_array

Even Rouault-2
On vendredi 13 mars 2020 16:23:27 CET Jon Morris wrote:
> Thanks for the quick fix, Even! Glad it wasn't just something I'd missed.
>
> I'm not entirely clear on the uses for gdal_array. Are there cases where it
> is better than using a MEM raster?

I don't think so. It uses the MEM driver underneath. This is just a matter of
using different entry points to the same backend.

> Is there any more detailed documentation?

Not sure. Documentation is not the strongest point of the bindings :-) Looking
at unit tests / using the search function in the github repo is sometimes
useful to find relevant snippets.

Even

--
Spatialys - Geospatial professional services
http://www.spatialys.com
_______________________________________________
gdal-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/gdal-dev