I'm using QGIS Desktop (version 2.18.3 on Windows) and have a python script that works in the python console. My script:
- Loads a shapefile (of properties in a city, identified by a PropertyID)
- Searches and zooms into a specific property (currently for testing purposes, the PropertyID is hardcoded)
- Loads a print composer template and displays the property from the above step
- Using the "Maps Printer" plugin, exports the print composer as a PNG
Everything in my script works correctly in QGIS' python console. Now I would like to call this python script from a web page. Ideally, it would be:
- Web page lets the user enter a PropertyID
- Web page passes that PropertyID to my python script, which then generates the PNG and then displays it to the user
Is my web interface scenario possible and if so, what would be the easiest way to achieve this?
I looked at installing QGIS Server (as opposed to QGIS Desktop), but I couldn't find a way to execute my script (and also pass in my PropertyID as a parameter)
As an automation test, I also tried running QGIS through the command line:
qgis --nologo --project "MyProject.qgs" --code "MyScript.py"
But while it created the PNG, it never updated the map whenever I tried changing the PropertyID in the script itself - plus it's not a scalable solution for multiusers.
I'm open to any suggestions on how to achieve this, even if it requires changing to a Unix platform.