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

[Bug]: LWC 3.7.0 and QGIS 3.34 raster - symbology #4036

Closed
1 task done
josemvm opened this issue Dec 20, 2023 · 51 comments
Closed
1 task done

[Bug]: LWC 3.7.0 and QGIS 3.34 raster - symbology #4036

josemvm opened this issue Dec 20, 2023 · 51 comments
Labels
bug legend/layer tree Tool which displays the layer tree with legends QGIS Server

Comments

@josemvm
Copy link
Collaborator

josemvm commented Dec 20, 2023

What is the bug?

qgis desktop 3.22.16
imagem
LWC 3.6.8
imagem

===========
qgis desktop 3.28.13
imagem
LWC 3.7.0
imagem

Steps to reproduce the issue

.

Versions

Versions :

  • Lizmap Web Client : 3.7.0
  • Lizmap plugin : 4.1.1
  • QGIS Desktop : 3.28.13
  • QGIS Server : 3.28.13
  • Py-QGIS-Server : not used
  • QGIS Server plugin atlasprint : 3.3.2
  • QGIS Server plugin lizmap_server : 2.8.1
  • QGIS Server plugin wfsOutputExtension : 1.8.0
List of safeguards :
  • Mode : normal
  • Allow parent folder : no
  • Prevent other drive : no
  • Prevent PG service : no
  • Prevent PG Auth DB : no
  • Force PG user&pass : no
  • Prevent ECW : no

Check Lizmap plugin

  • I have done the step just before in the Lizmap QGIS desktop plugin before opening this ticket. Otherwise, my ticket is not considered valid and might get closed.

Operating system

Ubuntu 22.04

Browsers

Firefox

Browsers version

Firefox 120.0.1

Relevant log output

No response

@josemvm josemvm added the bug label Dec 20, 2023
@josemvm
Copy link
Collaborator Author

josemvm commented Dec 23, 2023

in case of linear interpolation, not for discrete or exact interpolation

@Gustry
Copy link
Member

Gustry commented Jan 26, 2024

Similar to qgis/QGIS#55651 ?

@josemvm
Copy link
Collaborator Author

josemvm commented Jan 26, 2024

no, only in case of linear interpolation type not for discrete or exact interpolation type

@Antoviscomi
Copy link
Contributor

Antoviscomi commented Feb 5, 2024

@josemvm in my LWC 3.7 the color ramp it's not rendered (there isn't a ramp in legend) as in screenshot below
Schermata del 2024-02-05 11-44-41
respect to QGIS
Schermata del 2024-02-05 11-44-23

in LWC 3.6.9 it seems compressed as in screenshot below
Schermata del 2024-02-05 11-56-13

so I confirm the Issue

@josemvm
Copy link
Collaborator Author

josemvm commented Feb 5, 2024

@Antoviscomi thanks
maybe a qgis server bug...

@Gustry
Copy link
Member

Gustry commented Feb 5, 2024

Lizmap is taking the JSON legend from QGIS Server, as you can see in the ticket I mentioned earlier.
You can open your "developer tools" (F12), check the request made to QGIS server GetLegendGraphic and check the content of the JSON response. It's in the webbrowser.

@josemvm
Copy link
Collaborator Author

josemvm commented Feb 5, 2024

@Gustry the url from lizmap doesn´t contain the GetLegendGraphic
myhost/index.php/lizmap/service?repository=ma&project=PIAAC-AC&REQUEST=GetMap&SERVICE=WMS&VERSION=1.3.0&FORMAT=image%2Fpng&STYLES=default&TRANSPARENT=true&LAYERS=lst_inv_ac&DPI=96&WIDTH=2080&HEIGHT=475&CRS=EPSG%3A3763&BBOX=-253278.93184485074%2C-179934.01850668347%2C297055.50215735065%2C-54256.68381868075&ts=1707138769681

i can replace the request for myhost/index.php/lizmap/service?repository=ma&project=PIAAC-AC&REQUEST=GetLegendGraphic&FORMAT=image&&SERVICE=WMS&VERSION=1.3.0&FORMAT=image%2Fpng&STYLES=default&TRANSPARENT=true&LAYERS=lst_inv_ac&DPI=96&WIDTH=2080&HEIGHT=475&CRS=EPSG%3A3763&BBOX=-253278.93184485074%2C-179934.01850668347%2C297055.50215735065%2C-54256.68381868075&ts=1707138769681

and get:
imagem

@Gustry
Copy link
Member

Gustry commented Feb 5, 2024

This a GetLegendGraphic as a picture.
Now, Lizmap use the GetLegendGraphic as JSON, to be able to have a checkbox

image

@Gustry
Copy link
Member

Gustry commented Feb 5, 2024

in 3.7 there is not a similar request in browser's 'developer tools'

There is, check my screenshot, it's a POST request. There must be a GetLegendGraphic request ... it's the only way to ask QGIS server for the legend.

@Antoviscomi
Copy link
Contributor

@Gustry there is not a request GetLegendGraphic on mine that's all
Schermata del 2024-02-05 17-11-53

@Antoviscomi
Copy link
Contributor

only in Payload it is, and no response in LWC 3.7
repository=tempor&project=ProvaFiles&SERVICE=WMS&REQUEST=GetLegendGraphic&VERSION=1.3.0&FORMAT=application%2Fjson&LAYER=edificicetraro_ctr%2Cterritori_boschi_foreste%2Corto2008&STYLES=predefinito%2Cpredefinito%2Cpredefinito

@Gustry
Copy link
Member

Gustry commented Feb 5, 2024

there is not a request GetLegendGraphic on mine that's all

In your screenshot, it's the last one. Click one it, you will see in the Request tab, then open the "Response tab" and paste the content here

@Antoviscomi
Copy link
Contributor

@Gustry
this is the response

{
    "nodes": [
        {
            "symbols": [
                {
                    "title": "Band 1"
                },
                {
                    "title": ""
                }
            ],
            "title": "Temperatura Massima (\u00b0C)",
            "type": "layer",
            "name": "orto2008",
            "layerName": "Temperatura Massima (\u00b0C)"
        }
    ],
    "title": ""
}

@Gustry
Copy link
Member

Gustry commented Feb 5, 2024

There isn't any icon key in the JSON.

This JSON is generated by QGIS Server, it's a graphical legend in JSON format.

This issue must be reported in QGIS. When QGIS will be fixed, it's high probability that the icon will be displayed in Lizmap Web Client then.

@Gustry Gustry closed this as not planned Won't fix, can't repro, duplicate, stale Feb 5, 2024
@Antoviscomi
Copy link
Contributor

@Gustry why in LWC 3.6.9 it works? There is not the same request?

@Gustry
Copy link
Member

Gustry commented Feb 5, 2024

  • Before 3.7 : you can see your URL you have provided : FORMAT=image/png, QGIS server must give back to Lizmap Web Client a PNG file
  • Now with 3.7, you can see FORMAT=application/json, QGIS server must give back a JSON representation of the legend.

So the bug is quite similar to qgis/QGIS#55651 as I mentioned before. QGIS server is skipping some layers in the JSON representation.

@nboisteault
Copy link
Member

@Gustry So we could use the FORMAT=image/png request for raster layers?

@josemvm
Copy link
Collaborator Author

josemvm commented May 14, 2024

@Gustry So we could use the FORMAT=image/png request for raster layers?

@Gustry is it possible fix it with the workaround above? this is a little annoying... in production environment

thanks

@Gustry Gustry added the legend/layer tree Tool which displays the layer tree with legends label May 14, 2024
@Gustry
Copy link
Member

Gustry commented May 14, 2024

Yes @josemvm I know this issue, it's unfortunate and I understand...
But there is nothing I can do here, I'm doing the same answer as on #4328 (comment)
Feel free to contact us.

@Gustry
Copy link
Member

Gustry commented May 16, 2024

Given the work in 3liz/qgis-lizmap-server-plugin#77 we could notice that rendering the raster legend with QGIS < 3.34 is broken.

Supporting raster legend 3.7 will only work at least with QGIS 3.34.

@josemvm which version are you using ?
@Antoviscomi We can see your request that this is a QGIS Server < 3.34

@josemvm
Copy link
Collaborator Author

josemvm commented May 16, 2024

hi @Gustry i'am using qgis server 3.28

@Gustry
Copy link
Member

Gustry commented May 16, 2024

???

@josemvm We understand when there is a minimum of text and also when there is a single ?. It looks like #4377

this is a little annoying... in production environment

This is annoying as well to read, when we are spending so many "unpaid" time trying to make an opensource product.

@Antoviscomi
Copy link
Contributor

Antoviscomi commented May 16, 2024

@Gustry the above request was february 5 dated, now I'm on 3.36 version of QGisServer but I've not looked at this issue anymore, so I cannot tell It's yet here. I can test it asap if needed

@Gustry this is the request from LWC 3.7.7 on QGISServer 3.36.2

{
    "nodes": [
        {
            "symbols": [
                {
                    "title": "Band 1: Red (Red)"
                },
                { 
                    "icon": "iVBORw0KGgoAAAANSUhEUgAAADMAAABgCAYAAACwu0pzAAAACXBIWXMAAA9hAAAPYQGoP6dpAAADLElEQVR4nO2cPWgUQRTHf7c3dwQLo6DBQjSiVooRLBRRRBPshdhoSvEDO4UoCqaIiCi2EgsLCytBEK2EIPgBAVExxESTKCqIH4Wa+EFy5G4t3orDGu8iu9mbPOYPw+7Nm9uZ\/\/3fezsL9zbXfKk1JAFeH+jNJfl+mjDFvDNrSQxTCIJ6ryE1mGJeD5mgmA9I0maIM0A\/8BN4B\/QAjZa9HQhj7ZZlXzSN\/Xt8kqxipgk4AgwAS4ErwEVgrzVmGGixPpenuU4z8DE6\/ytxZeVm+6zzDwiRztiYEJiocZ3JamNMsT4JYCvwJNa3DHgFlIA+oAt4ExtzFygAQ4jr3reN9UjN+4FWYJPVN4DEzTCwGDgJ3AHWA+NIrHUAjwGDuGcvsBl49PsippBtNjscLXQH8NLqfx41gFGE2BdgG3ATIXPVGn8c2AjswSaTYWo+ARwCtgMvaoydQhJAvsqYUtyeFZmziGvsROKgAQn4ycjejhB8i7hZF\/ANiRGALdFxCImZDkTd0\/YkphjMesw0AMei80Grv4z4P8A64AKwBHGvPqAN+BzZm4BuYAWiyCCwC7hnT5SFMhNArV\/sVNT+hetRqwpV2xlT0LRrrtNNc1agy81UPZwpU0YRGWWPzT5mnIQxgak9ao7A5HPVdtlzC7qUMV4ZN2Hymsh4N3MUPjW7Ch8zrsKnZlehzM28Mm5CFxnvZo7Cp2ZX4WPGVRjKU\/VeQ2owTGkio0oZVWS8m7kJE3pl3IQyMt7N3IShPN2fVOcmvJu5Cq+Mq1BGRpObhaqUUUVGk5t5ZRyFLmUqJUUbzVATmcqkIjJhqVLvNaQGHzOuQpcyyhKAIjKq3EyTMkGlVCFJm+k8SK3mJ+AHcAMpY0wVWSWATqRQtA14D1wGriEF26khKzc7iBSV9kefjyJF2WuAZ2lNkkUCaASWAw+tvhGkmryFNMlkoMz86DgW6\/9q2VJBFjEzHh0bY\/0LLFsqyEKZMaTSfAN\/3qywElHlaZoTZXXT7EFeCHIbyWbngQekGC8A5j\/uFUlwDliI1PfPQ14ZsTvtSXKja1cnelfTqoERZ8oJ\/a7ZVajaNf8C5uAfAthJht8AAAAASUVORK5CYII=",
                    "max": 255,
                    "min": 0,
                    "title": ""
                }
            ],
            "title": "550041_ORTO",
            "type": "layer",
            "name": "l_550041_ORTO",
            "layerName": "550041_ORTO"
        }
    ],
    "title": ""
}

and this is the result on LWC 3.7.7 Canvas and TOC

Schermata del 2024-05-16 16-12-43

the legend is now visible but however it seems a little bit small

@Gustry
Copy link
Member

Gustry commented May 16, 2024

Thanks for checking @Antoviscomi

@Antoviscomi
Copy link
Contributor

It's a pleasure @Gustry

@josemvm
Copy link
Collaborator Author

josemvm commented May 16, 2024

@Gustry i'm sorry, you are right but i had no intention of hurting anyone or devaluing your work or project

@gioman
Copy link
Contributor

gioman commented Jun 16, 2024

and this is the result on LWC 3.7.7 Canvas and TOC

Schermata del 2024-05-16 16-12-43

the legend is now visible but however it seems a little bit small

Doesn't this mean that the reported issue is fixed (meaning also that QGIS 3.34 is necessary?)?

@Gustry
Copy link
Member

Gustry commented Jun 17, 2024

Using QGIS 3.34 is indeed better, but the image provided by QGIS server is too small.
Definitely do not use QGIS < 3.34 for raster symbology.

@Antoviscomi
Copy link
Contributor

Antoviscomi commented Jun 17, 2024

@Gustry @gioman in 3.36 version it's small also, so I think it's better to try to adjust the served image dimension before to render it in legend (i.e. managing it with a zoom control?)

@Antoviscomi
Copy link
Contributor

Antoviscomi commented Jun 17, 2024

The default values of height and width are 16 px, if its possible to change it only for raster legend, i .e. via bootstrap or via script, the image become as large as we need (this as workaround).
in the belowe screenshots I've symply altered theese values in legend style to h = 75 px and W = 35 px

Schermata del 2024-06-17 10-33-25

Schermata del 2024-06-17 10-43-13

@Gustry Gustry changed the title [Bug]: lwc 3.7.0 raster - symbology [Bug]: LWC 3.7.0 and QGIS 3.34 raster - symbology Jun 17, 2024
@gioman
Copy link
Contributor

gioman commented Jun 17, 2024

Using QGIS 3.34 is indeed better, but the image provided by QGIS server is too small.

@Gustry any reason why QGIS server returns (on purpose?) such small raster legend?

@Gustry
Copy link
Member

Gustry commented Jun 17, 2024

I don't know. Maybe first developed for vector purpose/testing ?

According to the PR I made, the GetLegendGraphic JSON was working nicely on QGIS 3.16. Then with LTR 3.22 and 3.28, the JSON was broken, and then on 3.34, the JSON output is back, so no a lot of users on QGIS 3.22 and 3.28 it seems.

@gioman
Copy link
Contributor

gioman commented Jun 18, 2024

I don't know. Maybe first developed for vector purpose/testing ?

According to the PR I made, the GetLegendGraphic JSON was working nicely on QGIS 3.16. Then with LTR 3.22 and 3.28, the JSON was broken, and then on 3.34, the JSON output is back, so no a lot of users on QGIS 3.22 and 3.28 it seems.

@Gustry not sure I follow: what would be the ideal fix here, patch QGIS Server to generate raster legends with a more reasonable size?

@josemvm
Copy link
Collaborator Author

josemvm commented Jun 18, 2024

According to the PR I made, the GetLegendGraphic JSON was working nicely on QGIS 3.16. Then with LTR 3.22 and 3.28, the JSON was broken, and then on 3.34, the JSON output is back, so no a lot of users on QGIS 3.22 and 3.28 it seems.

@Gustry according to my latest experiences, I think the problem lies on LWC and not on qgis server.
i have tested on qgis server 3.28 and LWC 3.6.14-pre and this last version of LWC can render the raster symbology perfectly:
imagem

@josemvm
Copy link
Collaborator Author

josemvm commented Jun 18, 2024

ok, sorry...

This a GetLegendGraphic as a picture.
Now, Lizmap use the GetLegendGraphic as JSON, to be able to have a checkbox

@Gustry
Copy link
Member

Gustry commented Jun 18, 2024

i have tested on qgis server 3.28 and LWC 3.6.14-pre

@josemvm Before LWC 3.7, whatever the version of QGIS server, the format is PNG #4036 (comment)

@josemvm
Copy link
Collaborator Author

josemvm commented Jun 18, 2024

@josemvm Before LWC 3.7, whatever the version of QGIS server, the format is PNG #4036 (comment)

@Gustry 3.22(.16)

@Gustry
Copy link
Member

Gustry commented Jun 19, 2024

@josemvm "Whatever" means "regardless" ;-)
It doesn't matter the version of QGIS server used, only LWC version, requesting the legend in JSON format.

@Gustry not sure I follow: what would be the ideal fix here, patch QGIS Server to generate raster legends with a more reasonable size?

@gioman Yes, being able to set the size of the picture would be better, or at least increase it by default, like the rendering in QGIS Desktop.

Doing the tip of @Antoviscomi works, but with text/fonts, this can lead to "transformed vertically" text

@Antoviscomi
Copy link
Contributor

Antoviscomi commented Jun 19, 2024

Doing the tip of @Antoviscomi works, but with text/fonts, this can lead to "transformed vertically" text

@Gustry i meanth that the 'zoom/size' control should acts on the png part only of raster legend served by QGIS Server, obviously if is possible to manage it separately from text part, so that the text part will not deformed

@gioman
Copy link
Contributor

gioman commented Jun 19, 2024

@gioman Yes, being able to set the size of the picture would be better, or at least increase it by default, like the rendering in QGIS Desktop.

@Gustry so this is the ideal solution you are looking for, correct?

@gioman
Copy link
Contributor

gioman commented Jun 19, 2024

Doing the tip of @Antoviscomi works, but with text/fonts, this can lead to "transformed vertically" text

I'm not sure I understand how the workaround works.

@Antoviscomi
Copy link
Contributor

Antoviscomi commented Jun 19, 2024

I'm not sure I understand how the workaround works

@gioman I suggest to add a size control in LWC that allow to manage the height/width of png legend served by QGIS server (now the default size readed by LWC is 16x16px, that seems very small) so a control (hardcoded in LWC css i.e.) should permit to well adapts these dimensions

@josemvm
Copy link
Collaborator Author

josemvm commented Jun 19, 2024

@josemvm Before LWC 3.7, whatever the version of QGIS server, the format is PNG https://github.com/3liz/lizmap-web-client/>issues/4036#issuecomment-1927391719

@Gustry i misinterpreted your affirmation
thanks

@josemvm
Copy link
Collaborator Author

josemvm commented Jun 19, 2024

maybe an option in the lizmap plugin to GetLegendGraphic as a picture/png, only for lwc 3.7 (?)

@Gustry
Copy link
Member

Gustry commented Jun 19, 2024

Thanks @Antoviscomi for the correction, indeed, way better !

@josemvm yes, we have talked about that internally. It might be needed maybe for some rendering engine, for like proportional circle. Feel free to contact us.

Antoviscomi added a commit to Antoviscomi/lizmap-web-client that referenced this issue Jun 20, 2024
Solve 3liz#4036
[Bug]: LWC 3.7.0 and QGIS 3.34 raster - symbology
@Antoviscomi
Copy link
Contributor

Antoviscomi commented Jun 20, 2024

@Gustry @gioman @josemvm

Senzanome
setting

height: 'auto;

in map.css at

lizmap-treeview img.legend{
    height: 16px;
    width: 16px;
}

the png raster legend it seems to works as expetted

@Gustry
Copy link
Member

Gustry commented Jun 20, 2024

Thanks @Antoviscomi for the fix
Fixed in next 3.7 and 3.8

@Gustry Gustry closed this as completed Jun 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug legend/layer tree Tool which displays the layer tree with legends QGIS Server
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants