3liz / lizmap-web-client

Transfer a QGIS project on a server, Lizmap is providing the web interface to browse it
https://www.lizmap.com
Mozilla Public License 2.0
257 stars 144 forks source link

[Question]: Data processing within Lizmap #3707

Closed sag1687 closed 1 year ago

sag1687 commented 1 year ago

What is the question?

Hello everyone, I would like to understand if it is possible to integrate a module in Lizmap or an input box that should work in the following way:

1) When I click on a point on the map, a popup or similar appears displaying some data from the map element, such as x, y, z values from a shapefile.

2) After obtaining this data, I need to have the ability to add additional information.

3) The information entered, along with the existing data, will be processed by JavaScript or Python, which will generate a new window displaying the result of the calculations, such as hydraulic variance calculation or similar.

Please let me know if this kind of integration and functionality is possible with Lizmap or if there are any alternative approaches to achieve this. Thank you!

Versions

QGIS_316 Lizmap 3.6

Check Lizmap plugin

QGIS server version, only if the section above doesn't mention the QGIS Server version

3.16

Operating system

ubuntu server

Browsers

Firefox

Browsers version

92

Relevant log output

No response

Gustry commented 1 year ago

Either look at "actions" to laucnh SQL queries :

Or at WPS, where you can launch all the QGIS processing API (model, script, native algorithms from the QGIS processing toolbox) :

sag1687 commented 1 year ago

Is there a complete tutorial available or is it possible to see the example shown here: https://github.com/3liz/lizmap-wps-web-client-module?

Gustry commented 1 year ago

Only the GIF as a demo.

sag1687 commented 1 year ago

in Is it possible to download the project or test it online?

sag1687 commented 1 year ago

For some time now, I've been wanting to integrate a procedure into my Lizmap project. I have found various instructions, but many of them don't work because they are not up to date. I would like to be able to input new data along with the existing data and obtain an output. I have been advised to use either actions in PostgreSQL or the WPS module with a Python script. However, the procedure is still unclear to me, and I'm wondering if someone could provide a more detailed explanation, breaking down each step as if explaining to a beginner.

Here's the translation in English:

"I have been wanting to integrate a procedure into my Lizmap project for some time now. I have come across various instructions, but many of them are outdated and don't work. I would like to have the ability to input new data along with the existing data and obtain an output. I have been advised to either use actions in PostgreSQL or the WPS module with a Python script. However, I still don't have a clear understanding of the procedure. Can someone provide a more comprehensive explanation and guide me through each step as if explaining to a beginner?"

gioman commented 1 year ago

I second the request: while the docs for installing the WPS module for LM seem straightforward, is a bit unclear (at least to me) how then it works together with https://github.com/3liz/py-qgis-wps (I'm assuming that py-qgis-wps must be used for the LM WPS module).

Gustry commented 1 year ago

I'm assuming that py-qgis-wps must be used for the LM WPS module).

gioman commented 1 year ago
  • The WPS module for Lizmap is only the frontend side for : displaying WPS algorithms which are available, executing WPS algorithms with customized parameters and displaying results in the current project. The module is like a "client" for the WPS server.

  • The Py-QGIS-WPS is the backend side, adding WPS capabilities on top of QGIS server, by listing Python processing script, the QGIS processing toolbox etc over the internet

@Gustry thanks, the above was clear.

I'm struggling to put the pieces together while reading the docs, before really starting to try on a test machine. For example in the WPS module docs I don't really understand what is the difference from wps_url and ows_url and what is wps_rootDirectories ("is the path of the directories defined for the WPS Service MAP"), I can't find any reference about it in the py-QGIS-WPS docs. Thanks in advance.

dmarteau commented 1 year ago

WPS module docs I don't really understand what is the difference from wps_url and ows_url

You will have two different backends: one for WFS/WMS wich correspond to the ows_url and one for the WPS service (py-qgis-wps) for which the wps_url is the enty point for.

and what is wps_rootDirectories ("is the path of the directories defined for the WPS Service MAP"

This is the root directory where your projects are stored.

3liz-bot commented 1 year ago

This issue is missing some feedbacks. 👻 Please have a look to the discussion, thanks. 🦎

3liz-bot commented 1 year ago

This issue is missing some feedbacks. 👻 Please have a look to the discussion, thanks. 🦎

r9zzai commented 10 months ago

You can do this with serverside conda env. The url provides the qgs filename. From there you can send an ajax request to php which shell executes your bash file to activate your conda env and executes your qgis python file.

The tricky is that you have to know which layer is relevant. If you click on a layer you may retrieve multiple active layer popups. You have to find a way that if you request a layer popup that its unumbiguous by e.g. deactivating all other layers. Then you can read the active layer name and send it via ajax to python reading the .cfg file to get the layer of interest.