qgis / qwc2-demo-app

QWC2 demo application
Other
242 stars 155 forks source link

Not able to create/show categorized layer? #524

Closed 9ls1 closed 4 months ago

9ls1 commented 9 months ago

I'm using qwc-docker generating themes from qwc-admin-gui. image

Despite following the instructions from Split categorized layers , the layer is not splitted (categorized) in QWC2 as it is in QGIS.

QGIS image

QWC2 image

split_categorized.py is downloaded and saved in volumes/qgis-server-plugins/split_categorized image

qwc-qgis-server container is configured:

qwc-qgis-server: image: sourcepole/qwc-qgis-server:3.28-plugins

ports:

#   - "127.0.0.1:8001:80"
volumes:
  - ./volumes/qgs-resources:/data:ro
  - ./pg_service.conf:/etc/postgresql-common/pg_service.conf:ro
  - ./volumes/qgis-server-plugins/split_categorized:/usr/share/qgis/python/plugins/split_categorized:ro

The layer has a variable convert_categorized_layer true. image

Then I successfully generate themes configuration. However, the layer is not splitted (see images above).

Any idea where I go wrong?

manisandro commented 9 months ago

If you enable INFO logging in qgis server:

  qwc-qgis-server:
    environment:
      QGIS_SERVER_LOG_LEVEL: 0

do you see in the qwc-qgis-server-log the following log entry?

qwc-qgis-server_1              | 09:05:19 INFO Server[73]: Server plugin split_categorized loaded!
9ls1 commented 9 months ago

@manisandro Thanks, I enabled INFO-logging, but I'm not able to find/see qwc-qgis-server-log? However, I have located /var/lib/docker/containers and had a look in the qwc-qgis-server container (xxxx-json.log, finding the contianer id xxxx with sudo docker ps), and can't find any string containing 'split'. Not a good sign, I assume. (I have INFO Server[72] and INFO Server[109 ] - if this means anything.)

manisandro commented 9 months ago

You can see the log via docker-compose logs -f qwc-qgis-server

9ls1 commented 9 months ago

@manisandro Thanks for the command making log-retrieving much easier. However, no sign of split in the log log_qgis_server_20240207_01.txt

manisandro commented 9 months ago

So the plugin probably isn't mounted correctly, or the docker container not recreated with the new configuration. Did you recreate the server container with docker-compose up qwc-qgis-server after changing the configuration in the compose file?

9ls1 commented 9 months ago

@manisandro Yes, I have tried several things like restarting docker, stopping docker and starting docker, recreating the server container, but without any luck in seeing "Server plugin split_categorized loaded!" nor splitted layers in QWC2. The split_categorized.py is placed in /xxx/xxx/qwc-docker/volumes/qgis-server-plugins/split_categorized corresponding to the instructions: ...

volumes:

-./volumes/qgis-server-plugins/split_categorized:/usr/share/qgis/python/plugins/split_categorized:ro

... Not sure how else to mount the plugin.

manisandro commented 9 months ago

Last idea would be to docker-compose exec qwc-qgis-server bash and then check within the docker container that the plugin files are indeed there as expected and readable.

9ls1 commented 9 months ago

@manisandro Thanks for you time and help. Yes, I do find the plugin in expected(?) folder:

www-data@e3409b73647a:/usr/share/qgis/python/plugins/split_categorized$ ls -l total 8 -rwxr-xr-x 1 root root 6938 Feb 7 12:57 split_categorized.py www-data@e3409b73647a:/usr/share/qgis/python/plugins/split_categorized$

Originally it was user and group like 1003 and 1005 respectively - no luck. It was then changed to root root - didn't help. In the log I see:

... qwc-qgis-server-1 | 11:38:31 INFO Server[72]: Plugin PATH: /usr/lib/qgis/plugins qwc-qgis-server-1 | 11:38:31 INFO Server[72]: PkgData PATH: /usr/share/qgis qwc-qgis-server-1 | 11:38:31 INFO Server[72]: User DB PATH: /etc/qgis.db qwc-qgis-server-1 | 11:38:31 INFO Server[72]: Auth DB PATH: /var/lib/qgis/qgis-auth.db qwc-qgis-server-1 | 11:38:31 INFO Server[72]: SVG PATHS: /usr/share/qgis/svg/:/etc/svg/ qwc-qgis-server-1 | "Loading native module /usr/lib/qgis/server/libdummy.so" qwc-qgis-server-1 | 11:38:31 INFO Server[72]: Adding service SampleService 1.0 qwc-qgis-server-1 | "Loading native module /usr/lib/qgis/server/liblandingpage.so" qwc-qgis-server-1 | 11:38:31 INFO [72]: Adding API Landing Page qwc-qgis-server-1 | "Loading native module /usr/lib/qgis/server/libwcs.so" qwc-qgis-server-1 | 11:38:31 INFO Server[72]: Adding service WCS 1.0.0 qwc-qgis-server-1 | "Loading native module /usr/lib/qgis/server/libwfs.so" qwc-qgis-server-1 | 11:38:31 INFO Server[72]: Adding service WFS 1.1.0 qwc-qgis-server-1 | 11:38:31 INFO Server[72]: Adding service WFS 1.0.0 qwc-qgis-server-1 | "Loading native module /usr/lib/qgis/server/libwfs3.so" qwc-qgis-server-1 | 11:38:31 INFO [72]: Adding API OGC WFS3 (Draft) qwc-qgis-server-1 | "Loading native module /usr/lib/qgis/server/libwms.so" qwc-qgis-server-1 | 11:38:31 INFO Server[72]: Adding service WMS 1.3.0 qwc-qgis-server-1 | 11:38:31 INFO Server[72]: Adding service WMS 1.1.1 qwc-qgis-server-1 | "Loading native module /usr/lib/qgis/server/libwmts.so" qwc-qgis-server-1 | 11:38:31 INFO Server[72]: Adding service WMTS 1.0.0 qwc-qgis-server-1 | 11:38:31 INFO Server[72]: Initializing 'filesystem' cache strategy qwc-qgis-server-1 | 11:38:31 INFO Server[72]: Server initialized qwc-qgis-server-1 | 11:38:31 INFO ./src/server/qgsserverplugins.cpp[72]: load library /usr/lib/qgispython (3.28.15) qwc-qgis-server-1 | 11:38:31 INFO ./src/server/qgsserverplugins.cpp[72]: Python support library loaded successfully. qwc-qgis-server-1 | 11:38:31 INFO Server[72]: Server plugin ClearCapabilities loaded! qwc-qgis-server-1 | 11:38:31 INFO Server[72]: Server python plugins loaded qwc-qgis-server-1 | 11:38:31 INFO Server[72]: **** New request *** ...

I note Plugin PATH: /usr/lib/qgis/plugins (and not /usr/share/qgis/plugins) and the only "loaded!" I find is "Server plugin ClearCapabilities loaded!".

Must the owner of the folder qgis-server-plugins (/xxx/xxx/qwc-docker/volumes/qgis-server-plugins) be root?

jonathanrizzi commented 4 months ago

Hello,

I am in the same situation. Plugin is installed, with all updated to the latest version as of July 15. The plugin is visible and readable from inside docker but it seems that is not loaded from the logfile. What addictional control can be done to find the issue?

Thank you!

manisandro commented 4 months ago

If you enter the container (docker compose exec qwc-qgis-server bash), can you read the plugin file? I.e.

cat /usr/share/qgis/python/plugins/split_categorized/split_categorized.py
jonathanrizzi commented 4 months ago

Hello,

Yes, I can read the file doing that command. The .qgs file with categories and the shapefile are copied into the directory "volumes/qgs-resources/scan". I tried also in the directory "volumes/config-in/default/qgis_projects" but in both the layer is not split.

Thank you.

manisandro commented 4 months ago

(The location volumes/config-in/default/qgis_projects is obsolete and should not be used anymore.)

Can you post the qgis server container logs?

Have you set convert_categorized_layer=true in the project variables?

jonathanrizzi commented 4 months ago

Hello.

Here the log. The variable is set.

log_20240717_01.txt

Thank you.

manisandro commented 4 months ago

As the ClearCapabilities plugin is loaded

qwc-docker-qwc-qgis-server-1  | 10:43:05 INFO Server[72]: Server plugin ClearCapabilities loaded!

the only other thing I can think of at distance is to compare the structure of the clear_capabilities plugin folder with the one of the split_categorized and see if there is any difference which stands out.

jonathanrizzi commented 4 months ago

Hi,

I noticed that and I had compared the files. It is exactly the same structure and files (except the name of the main py file), and same permissions. In the file system they are in different folder, but in docker they appear under same directory ans two separate folders, together with some other plugins directories. However no trace of the split categorized plugin in the log.

Thank you again.

manisandro commented 4 months ago

Short of setting up a custom qgis server container which runs as root and debugging the qgis server startup with strace I'm afraid I don't have any additional ideas at distance.

manisandro commented 4 months ago

I've managed to track this down on an affected system: it is a conflict between the split_categorized and the clear_capabilities plugins. I'll investigate further.

jonathanrizzi commented 4 months ago

Hello, thanks for the update. Looking forward for further information.

manisandro commented 4 months ago

This should be fixed by simply adjusting the plugin execution priority [1]. Closing, feel free to reopen if issues persist.

[1] https://github.com/qwc-services/qwc-qgis-server-plugins/commit/125ae32bd2011ff96e3b4cf4ef90dcaf68d53af5

jonathanrizzi commented 3 months ago

Hello,

We downloaded the newer version of the pluging, run everything again, and we see the menu like in the figure for the layer who should have the legend splitted, but nothing change when switching between the two options.

Is that correct? Are we doing something wrong?

Thank you.

image

manisandro commented 3 months ago

This use-case (i.e. switching to a categorized style) is currently not implemented.