Friday 12 April 2019

csv - Accessing existing instance of QGIS from stand-alone python script


For my own data analysis pipeline, I am running a split screen setup with iPython notebooks on one side, generating variables from source data, pushing them to a CSV file which QGIS then reads/joins to an appropriate geography, instantly visible on the other side of the screen.



I would like to push the control of the running instance of QGIS to the ipython notebook, in effect allowing a super quick calculation/visualization cycle. Right now I can do this in the QGIS python console with something like this:


canvas = qgis.utils.iface.mapCanvas()
cLayer = canvas.currentLayer()
canvas.refresh()

but I would like to:



  1. connect to an existing instance of qgis from an external python environment

  2. at a minimum refresh the map, after each re-write to the csv from ipython notebook, but preferably

  3. re-calculate breaks (using quantiles, natural breaks) based on the newly joined values



Any pointers appreciated!




No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...