3

Is there a way to update a PostGIS layer in QGIS (every 5 minutes for example) without needing to right click on the layer and going through the Update SQL layer dialogue as shown below?

enter image description here

The end goal is to have a live spatial layer that can be updated elsewhere by other users and for those updates to be reflected in the QGIS project as people work in that without them having to manually update the layer themselves.

FYI I am using QGIS 3.4.1

  • This question is better addressed to DBMS specialists who will write a trigger or function, update, which will be automatically updated for your tables, for example, every 5 minutes, according to your request... – Cyril Nov 12 '18 at 14:22
  • 1
    Just to clarify: do you want changes in the DB to be shown in QGIS, without having to do anything (not even pan the map a bit), or are you interacting with the map and you don't see DB updates until you refresh the SQL query? – JGH Nov 12 '18 at 14:34
  • @JGH I currently can't see updates in QGIS until I refresh the SQL query with the method described in the question – AWGIS Nov 12 '18 at 14:36
  • 2
    Just ZoomIn or ZoomOut should show the updates in the layer. – iRfAn Nov 12 '18 at 15:04
  • @iRfAn zooming in and out does not appear to update it for me – AWGIS Nov 13 '18 at 12:13
2

I think what you are looking for is the PostgreSQL notify commands. Read the following article https://oslandia.com/en/2017/10/07/refresh-your-maps-from-postgresql/

  • Thanks for this, I did not know this was possible. I haven't tested it yet but it appears to be what we are looking for. – AWGIS Nov 13 '18 at 12:25
  • 1
    Alternatively, you can just set the layer refresh in the properties of the layer under Rendering. This will just refresh your layer at a specific interval. This might have performance issue if your data is big – kartoza-geek Nov 14 '18 at 13:11
  • 1
    I tried this but it does not update as you would expect - it appears that it still needs to be manually updated. – AWGIS Nov 14 '18 at 13:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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