5

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

5
  • 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... Commented Nov 12, 2018 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? Commented Nov 12, 2018 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 Commented Nov 12, 2018 at 14:36
  • 2
    Just ZoomIn or ZoomOut should show the updates in the layer. Commented Nov 12, 2018 at 15:04
  • @iRfAn zooming in and out does not appear to update it for me Commented Nov 13, 2018 at 12:13

1 Answer 1

6

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/

3
  • 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. Commented Nov 13, 2018 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 Commented Nov 14, 2018 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. Commented Nov 14, 2018 at 13:25

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.