[Qgis-developer] Vector buffer commitChanges (was Interaction between QGis and ArcGis)

Radim Blazek radim.blazek at gmail.com
Fri Apr 19 23:39:26 PDT 2013

On Fri, Apr 19, 2013 at 12:07 PM, JVerholle <julien.verholle at eaurmc.fr> wrote:
> Hi all,
> If I want to open the same shapefile in both softwares at the same time, the
> file is locked in ArcGis (even if the edition mode isn't used in QGis).

QGIS opens layers (files) in update mode ("r+") if possible (file
permission + OGR driver support). It may (but also may not) be a
problem also for #6448 (slow shp over network) I am currently
struggling with. In general, I think that it is bad to open files
always in update mode even if in most cases they are not going to be

Currently there are no QgsVectorDataProvider::startEditing() and
commitChanges() which may also be a problem for database providers
because QgsVectorLayerEditBuffer::commitChanges() calls more provider
methods changing
data (deleteAttributes, addAttributes, deleteFeatures,
addFeatures...).  The commitChanges() should do everything in one
transaction IMO.

My proposal is to:
1) Add QgsVectorDataProvider::startEditing() and
2) In OGR provider try to open layer in update mode only to get
capabilities (get info if it can be modified when the provider is
constructed) but then to reopen in read only mode.
3) Call QgsVectorDataProvider::startEditing() from
QgsVectorLayer::startEditing() to be sure that the layer is still
editable (permissions could change or it was opened by another
application for editing since the layer was opened) and to reopen
files in update mode (files based) or to start transaction (DB based).
4) Call QgsVectorDataProvider::commitChanges() from
4) In QgsOgrProvider::startEditing() reopen the layer in update mode
5) In QgsOgrProvider::commitChanges() reopen the layer in read only mode

I am not sure if reopening of layers in OGR provider may be a
performance problem, but I hope that it should not be.

We don't really have to implement startEditing() and commitChanges()
in all providers for 2.0, but it should be in the vector API.


PS: Unfortunately, according to my current knowledge, this is not full
solution for #6448.

> ArcGis is enable to recognize the feature's type (we can see a "?" instead
> of polylign, polygon or point).
> This issue has been only noticed on Windows (and with ArcMap 9.2).
> Someone has already seen this problem ? Is it due to QGis or Gdal ?
> Thanks.
> Julien
> --
> View this message in context: http://osgeo-org.1560.x6.nabble.com/Interaction-between-QGis-and-ArcGis-tp5048256.html
> Sent from the Quantum GIS - Developer mailing list archive at Nabble.com.
> _______________________________________________
> Qgis-developer mailing list
> Qgis-developer at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-developer

More information about the Qgis-developer mailing list