I was wondering if I could produce webpages daily by automatically creating a standalone python script, outside of QGIS. My webpage should ideally contain various layers and an interpolation on top of them. I was wondering if without opening QGIS at all, I could use the QGIS2Web Plugin, as well as the Openlayers Map Plugin and call the requisite functions from these in a Python Script that I can schedule. I would want all of this to work on a Virtual Machine - so can't really call QGIS.

Note: I did come across various similar questions but there isn't any specific answer to my question.

I have so far been able to pretty much get most of my work working on the Python Console inside of QGIS. (I am using 2.18) - I was able to find the functions for basically reading shapefiles, performing interpolation, and then to call the function for QGIS2Web Plugin. What I aim to do is to essentially automate all of this, with different data on a daily basis.

Edit: I understand I haven't been able to put across the issue. Let me clarify.

I have a shapefile of a particular location, and data for a few points inside this shapefile's extent. I would like to interpolate over this region and produce a heatmap. I realised that using the Openlayer Plugin, I could add a google satellite image map layer to the current layers consisting of the layers for interpolation, data, as well as the initial shapefile, making the heatmap look more realistic as it would now be on top of an actual geographical area. Then I was just using the QGIS2Web tool to make HTML pages out of them.

What I really want to do is to automate this process, since I will be receiving the data real-time through sensors. Till now I have been successful enough in running successfully the processes of reading the data, the shapefile and performing interpolation, along with using QGIS2Web to create the HTML, through the in-built Python Console present in QGIS.

I was wondering if I could just do all of the above processes by using a Python Script outside of QGIS, by just appending the corresponding directories to which these belong.

  • 1
    Welcome to GIS.StackExchange, @Deepak Narayanan! Here is a tutorial about the execution of a python script that calls algorithms from the processing toolbox from a console in Windows, for QGIS 2. I hope you can adapt it to your needs. Avoid using the QGIS OpenLayers plugin. Please, edit your question to include what you have tried so far, what you have achieved and what you hoped to achieve. – Gabriel De Luca Mar 10 at 17:04
  • 1
    A specific +1 re: the QGIS OpenLayers plugin. It does not work with qgis2web, but many (?most) layers from the Quick Map Services plugin do. – Tom Chadwin Mar 11 at 15:52
  • 1
    Also, more importantly, I believe that although qgis2web does expose a couple of processing algorithms, they currently don't work (github.com/tomchadwin/qgis2web/issues/609). A simpler API for creating algs has recently been added to QGIS, and once it is backported to QGIS 3.4, hopefully the qgis2web algorithms can be fixed again. – Tom Chadwin Mar 12 at 12:26
  • Probably easier instead to pre-create your web page using some web mapping software/framework with your preferred basemap and then just update the heatmap as required from the data. Some frameworks even support creating heatmaps on the fly - such as MapBox – user2856 Mar 12 at 22:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.