I have a database table linked to the QGIS project which contains X,Y & Z coordinate information, which I can display in the Map View window of the project, after having used the “Points Layer from table” Geoalgorthim which creates a shp file that I can apply the required “Style” to and everything looks great. But routinely i.e. on a daily basis I need to add further points to the DB table and for this new information to be displayed without having to go through the process of apply the geoalgorithm and changing the style on a daily basis.

In ArcGIS, I was able to do this using in going down the XY Events process.

This is the acript I tried to use to retireve the data from an MS Access table (table- DPGDATA, database - SESIMIC Geodatabase.mdb

pts = processing.runalg("qgis:pointslayerfromtable", "H:\GEOPHYSICAL PROJECTS\SEISMIC Geodatabase.mdb|layername=DPGDATA", "Eastings", "Northings","EPSG:4236", None)

FURTHER QUERIES What is the script is required to give the Output layer a meaningful name. What script is required to load a predefined qml file to an individual layer. Lastly, I will need to routinely delete the old Output layer What is the script required to do this?

  • Apologizes for not expressing myself clearly enough in that the problem I have is that I am wanting to add further records to the table within the MS Access database, then when I open QGIS I want to be able to see that these these additional points been added to the layer created during a previous QGIS session. Jun 28, 2015 at 10:10
  • I've cleaned up some of our comments to make this thread easier to follow. Have you considered reopening the project instead of routinely removing the old output layer? Wouldn't that work just as well?
    – underdark
    Jun 30, 2015 at 16:48
  • Thanks for that, every time I run the macro it creates a new shapefile "OUTPUT" and stores it in a different location, this is also true for when I reopen the project. So it will be necessary to delete the previous shapefile. Jun 30, 2015 at 17:18

1 Answer 1


One option would be to add a small macro to the project properties which executes "points layer from table" automatically. For the styling, you can, for example, load a premade qml file.

import processing 

def openProject():
    pts = processing.runalg("qgis:pointslayerfromtable","C:/Users/anita/Geodata/qgis_sample_data/csv/elevp.csv","X","Y","EPSG:4326",None)

enter image description here

Check the Processing | Log to see the syntax for Access. I don't have any db at hand to test.


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.