Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QGIS Server: Single layer in group bug #1182

Closed
WCarlsson opened this issue Sep 21, 2022 · 9 comments · Fixed by #1188
Closed

QGIS Server: Single layer in group bug #1182

WCarlsson opened this issue Sep 21, 2022 · 9 comments · Fixed by #1188
Assignees
Projects
Milestone

Comments

@WCarlsson
Copy link

Describe the bug
When using a QGIS Server WMS-source served with a single layer in a group in the QGIS-project Hajk crashes when trying to set up a layer with the WMS-source.

To Reproduce
Steps to reproduce the behavior:

  1. Create a QGIS project with a single layer in a group and serve with QGIS Server.
  2. Try to add the WMS to Hajk
  3. Notice how Hajk crashes

Expected behavior
Hajk should handle groups with a single layer from QGIS. Groups with 0 or 2+ layers work fine.

Screenshots
Set up in QGIS Desktop
image

Snippet of error when Hajk crashes
image

  • Version Hajk 3.10
@jacobwod
Copy link
Member

Can you please share if/where this layer is available publicly? You can PM me in case you don't want to publish your server details here.

@jacobwod
Copy link
Member

Thanks for the info. I tried and got a crash already in Admin. This is an Admin bug, right?

@jacobwod
Copy link
Member

Hmm…
image

@jacobwod
Copy link
Member

OK, I can get pass the previous error by doing an isArray check. But there's another problem coming up, as QGIS Server tricks Admin to think that the last entry in the list below is a group (as it identifies itself as one), although it isn't. We'll need to investigate.

Skärmavbild 2022-09-23 kl  10 30 22

@jacobwod jacobwod added this to Approved ideas in Hajk via automation Sep 23, 2022
@jacobwod jacobwod added this to the 3.x milestone Sep 23, 2022
@jacobwod jacobwod self-assigned this Sep 23, 2022
@jacobwod jacobwod moved this from Approved ideas to In progress in Hajk Sep 23, 2022
@jacobwod
Copy link
Member

See fix/1182-single-layer-in-group-qgis-server.

@WCarlsson
Copy link
Author

OneLayerGroup is a group that contains a layer called Original_layer so it is correct to call it a group although it is missing the content of the group in the list.
This is the setup in QGIS Desktop
image

@jacobwod
Copy link
Member

jacobwod commented Sep 23, 2022

That's correct. The problem is that QGIS Server's WMS sends different responses depending on the amount of layers in group (which is strange - a group should be a group). If there are more 2 or more items, the group is an Array of layers. If there's one item, the "group" is the layer item, directly.

I'm not sure what the WMS specification says about it, but it's a clear case where the different WMS services handle things differently.

@jacobwod
Copy link
Member

Hi @WCarlsson, I've just pushed some fixes to https://github.com/hajkmap/Hajk/tree/fix/1182-single-layer-in-group-qgis-server. If you can, please check out that branch and build Admin (just Admin is enough, as there are not changes in the other directories) and see if it solves the problem. I've verified that the crash is prevented and that you can save additional fieds (such as infobox definition), but it's best if you test for yourself.

Skärmavbild 2022-09-26 kl  10 13 19

@WCarlsson
Copy link
Author

@jacobwod it works fine for me aswell.
Awesome work as always!

@jacobwod jacobwod modified the milestones: 3.x, 3.11 Sep 26, 2022
@jacobwod jacobwod moved this from In progress to Done in Hajk Sep 26, 2022
@Hallbergs Hallbergs linked a pull request Sep 27, 2022 that will close this issue
@jacobwod jacobwod closed this as completed Dec 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Hajk
  
Done
Development

Successfully merging a pull request may close this issue.

2 participants