11

I am considering moving many shapefiles to a newer format like GeoPackage.

Can GeoPackage handle multiple users editing the same file more or less simultaneously?

0

3 Answers 3

13

I have no technical background on how Geopackage works internally, so after searching for information on the simultaneous editing capabilities of Geopackage and barely finding anything conclusive, I decided to try it myself. I loaded the same Geopackage layers in two different Qgis (3.8.2) projects, and this is what I found out.

  • If the layer you want to edit is stored in a Geopackage file/database with other layers, concurrent editing on one of those layers doesn't seem to work: both users will get a database error when trying to save.
  • However, if the layer you want to edit is on a separate Geopackage file with no other layer, both users will be able to see and edit it at the same time.

This is the (apparent) behaviour in that second case:

  • If one user adds features to the layer and saves it, the other user will instantly see the new features in his loaded version of the layer, WITHOUT LOSING his/her own unsaved changes. It will also work in the opposite direction.
  • If one user DELETES one feature while the other is EDITING it, the deletion "wins". The edition is not propagated even if you save the layer. Deletion, however, does get propagated when the deleting user saves the layer.
  • If both users try to edit the same shape, the first one to save will propagate the changes to the other, but the other will still see the outline he/she was editing on top of the updated shape (see image below), and will be able to overwrite it on save. I don't know if that's a feature or just a (quite useful) bug.

Editing shape overlapped to updated shape

In conclusion, I wouldn't trust a Geopackage layer for all kinds of concurrent editing. But if both users are just adding objects or being sure they won't be editing the same ones, it seems to work very well, like almost real-time collaboration.

5
  • 2
    I dont understand, how the same layer could be in two different geopackage ?
    – J.R
    Commented Sep 18, 2019 at 21:28
  • 3
    Uh, maybe I didn't explain it properly. I mean that concurrent editing only seems to work if you are using one Geopackage file per layer, or one single layer in each Geopackage file... instead of a single Geopackage with several layers (including the one you are editing) inside. Edit: I just edited the answer. Commented Sep 21, 2019 at 17:03
  • 1
    Id argue that editing two different geopackage files at the same time, is not concurrent editing. Its like saying editing two different word documents at the same time is concurrent editing.............Geopackages are built off of SQLite Databases, and there is plenty of info out there explaining concurrent editing. Try here for more info softwareengineering.stackexchange.com/questions/340550/…
    – nr_aus
    Commented Oct 21, 2021 at 3:08
  • Hi, @nr_aus! For these tests, the very same Geopackage file, hosted in the local network, was loaded in two different Qgis sessions and edited at the same time. Thanks for the link! Commented Oct 21, 2021 at 16:49
  • Thanks Jorge - I understand your tests 'worked', how its also very easy to perform similar tests that don't work, and cause errors. It would be good to update your answer with examples of where it falls over , because it will fall over eventually. Try performing a larger number of edits from each user, before performing a save. this will probably very quickly cause an error.
    – nr_aus
    Commented Oct 22, 2021 at 5:47
4

Negativo, nadda, nope, nine, sorry no.

More information on this tread as well. But in short, geopackage files are not design for multi-user editing. They have no 'middleware' server application structure to coordinate and orchestrate transaction ordering/queue mechanisms.

Using QGIS SpatiaLite/Geopackage databases on shared network drives

Also more info on SQLite databases https://softwareengineering.stackexchange.com/questions/340550/why-are-concurrent-writes-not-allowed-on-an-sqlite-database

2
  • Did you link to this very same thread as a reference, or am I missing something? Commented Oct 21, 2021 at 16:51
  • I think the question got edited by a moderator and somehow my links are all mesed up. let me fix, thanks for pointing this out.
    – nr_aus
    Commented Oct 22, 2021 at 5:49
3

Short answer, do not use file based database for multi editing.

Use a proper database engine such as PostgreSQL.

1
  • Would this extend to attempting to write to a GeoPackage using parallel clusters? I know that SQLite does support this, but haven't found much documentation on whether or GeoPackages do as well. Commented Mar 2 at 18:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.