TransWikia.com

Refreshing QGIS after updating MS Access database?

Geographic Information Systems Asked on July 1, 2021

Why is QGIS not refreshing after updating a connected database?

It is a MS Access Database which I connected to QGIS using ODBC. The database contains coordinates of some vessels and they are already visible in QGIS but it is only refreshing when I disconnect and then reconnect the db connection.
I am looking for a solution the past few days but I am not possible to find any.

2 Answers

I use QGIS to access Filemaker databases via ODBC (also to map vessel data). I find that it will refresh with new data when QGIS is forced to re-draw, by either zooming or panning the map.

I recently detailed how the QGIS-ODBC-Filemaker connection is made here, and the same principles should also apply to Access:

Filemaker Interface with QGIS

Answered by Albert on July 1, 2021

I don't use ODBC actively so this is a bit of a stab in the dark.

With the recalcitrant layer selected, go to the Python console (Ctrl-Alt-P) in QGIS, and try entering the following

iface.activeLayer().dataProvider().forceReload()

This should force the dataprovider (OGR) to reload the data, which I hope should force it to actually go to the underlying (updated) data in Access.

If this does work, then there are ways (using Python startup code in your userprofile or in the project) this could e.g. be bound to a keyboard shortcut, so you could do it whenever needed without having to open the Python console.

Answered by Houska on July 1, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP