From the Windows Command Prompt (or Batchfile) I want to find the running QGIS instance with an open project. Afterwards a script (eg. zoom to something) should be automatically started. I've tried it with qgis.bat --code

That works fine, but always starts a new QGIS instance. - I don't want that!

In future I want to register a Windows Protocol for something like link2qgis:layer="layer".featid="123".action=zoomto

When clicking on that url in some third party application, the QGIS instance should be maximized and the map canvas should be zoomed to the feat.

Maybe someone has already done something similar and can help me with that.


There are two ways I see you can do this (there might be more)

  1. a web server running in the QGIS instance that listens for requests
  2. sockets

For 1. you can use something like Flask or the built in Python HTTP server running in a thread that just listens for for stuff and acts on it. You could use something like Curl (which might be installed with QGIS to call it from the command line)

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.