3

When using the offline editing plugin in QGIS to make a remotely accessed PostGIS layer editable offline, I have found that if there is a problem it is possible for my project to become stuck in offline mode. This means that the project only has the option to synchronize and the project can no longer be used to open a PostGIS layer and convert it to an offline project.

This has happened when the offline SQLite file has been moved, overwritten, created on network drive that is no longer accessible or the layer has been removed from the project while it is still offline.

I have also encountered problems when the synchronize has not worked, perhaps QGIS crashes or the connection to the database drops out. (Problems can be caused trying to Sync unsaved layer edits, or having other QGIS windows open that if interacting with them when syncing causes QGIS to hang).

Is there a way to 'repair' the project so that it's offline status can be reset?

1 Answer 1

3

There is a work around for this which involves opening the project .qgs file in a text editor, such as WordPad, removing the reference to the offline editing plugin, saving it and then carrying out a couple more steps in the opened project...

  1. Close QGIS.
  2. Use file explorer to find the project file you want to repair (with the extension .qgs)
  3. Right click on it and Open with > Wordpad

(if Wordpad is not listed because you haven’t used it before; • go to the windows button and either search for Wordpad and open it, or it can be found in All Programs > Accessories > Wordpad • In Wordpad browse to the .qgs file and open it.)

  1. Use ‘Find’ to find instances of “offline”, ignore most of them but keep pressing Next until you find the statement (or similar)…

    <OfflineEditingPlugin> <OfflineDbPath type="QString">./name_of_your_offline_file.sqlite</OfflineDbPath> </OfflineEditingPlugin>

  2. Delete these lines and press save.

This will reset the Offline editing plugin status so it is back to allow ‘Convert to offline project’.

  1. To finish cleaning things up, open the project in QGIS
  2. Remove the old offline PostGIS layer if you still have it in the project. Save
  3. Go to Project > Project Properties > General tab and delete ‘Offline’ in the Project Title. Save.

Your Answer

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

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