Closed nf-s closed 3 years ago
UPDATE: 2020-12-01 - fixed
This legend doesn't play well with transparency and looks glitched out: https://neii-viewer.dev.saas.terria.io/#share=s-94BSdBh0gJp5q4DBghC8zzN32M3
UPDATE: 2020-12-01 - fixed
The legend is completely broken and shows the broken image icon for neii-viewer v8: (Oceans --> Collaborative Australian Protected Areas Database (CAPAD) 2018 - Marine (DoEE))
UPDATE: 2020-12-01 - fixed
"It is difficult to read the text in the legend in dev (refer image in column d, and the prod image in column C). The font is too small and the black on dark grey doesn't have sufficient contrast. Please revert to current production standard. Similarly, the size of the colour blocks in dev (image in column E) are too small, to easily differentiate the colours, compared with the colour blocks in prod (column E)."
Will fix ontop of https://github.com/TerriaJS/terriajs/pull/4922
in NEII under Land > Victorian Soil Type Mapping, they want the image version of the legend rather than all the dimension selectors. Also it might be causing the layer to fail to load, see https://github.com/TerriaJS/neii-viewer/issues/165
This is separate - there is something going on with the WMS layers
Is trying to load a massive number of layers
Is not
Hello,
If there is a WMS layer which the legendUrl is like this:
`
`
Can TerriaJS displayed the legend image instead of showing a link asking user to download the image?
Source: https://services.ga.gov.au/gis/great-artesian-basin/wms?REQUEST=GetCapabilities&SERVICE=WMS
Thank you.
Martin
Hi @martin-bom
This is due to the legend URL having Format="image/png;charset=UTF-8"
We used to lookup the legend format in:
const DISPLAYABLE_MIME_TYPES = [
"image/jpeg",
"image/gif",
"image/png",
"image/svg+xml",
"image/bmp",
"image/x-bmp"
]
And if there isn't an exact match, we treat the legend as a link instead of image.
I have loosened this, so now it will also look at filename extension in the request.
I have rolled the change into this PR - https://github.com/TerriaJS/terriajs/pull/5247
I will post a link to test when the CI/CD has finished
Hi Nick,
Thank you for the reply.
In TerriaJS version 7 I tried to include both legend's URL into the parameter legendUrls
like this:
"legendUrls": ["https://services.ga.gov.au/gis/great-artesian-basin/ows?service=WMS&request=GetLegendGraphic&format=image%2Fpng&width=20&height=20&layer=gab%3APOTENTIOMETRIC_SURFACE_1980-2000", "https://services.ga.gov.au/gis/great-artesian-basin/styles/gab/legends/potentiometric_surface_grayscale_legend.png"]
And the outcome is:
Which is exactly opposite to the default behavior. Thank you.
Regards, Martin
Ahh I see!
This is happening because v7 won't identify the first legend as an image - due to lack of mimeType
and .png
extension.
Does this work for you:
"legendUrls": [
{
"mimeType": "image/png",
"url": "https://services.ga.gov.au/gis/great-artesian-basin/ows?service=WMS&request=GetLegendGraphic&format=image%2Fpng&width=20&height=20&layer=gab%3APOTENTIOMETRIC_SURFACE_1980-2000"
},
"https://services.ga.gov.au/gis/great-artesian-basin/styles/gab/legends/potentiometric_surface_grayscale_legend.png"
]
This is my catalog JSON:
{
"homeCamera": {
"north": -8,
"east": 158,
"south": -45,
"west": 109
},
"catalog": [
{
"layers": "gab:POTENTIOMETRIC_SURFACE_1900-1920",
"url": "https://services.ga.gov.au/gis/great-artesian-basin/wms?REQUEST=GetCapabilities&SERVICE=WMS",
"type": "wms",
"name": "POTENTIOMETRIC_SURFACE_1900-1920",
"legendUrls": [
{
"mimeType": "image/png",
"url": "https://services.ga.gov.au/gis/great-artesian-basin/ows?service=WMS&request=GetLegendGraphic&format=image%2Fpng&width=20&height=20&layer=gab%3APOTENTIOMETRIC_SURFACE_1980-2000"
},
"https://services.ga.gov.au/gis/great-artesian-basin/styles/gab/legends/potentiometric_surface_grayscale_legend.png"
]
}
]
}
Hi Nick,
Excellent! Your suggestion works perfectly and both legends are showing now. Thank you very much!
Regards, Martin
Great, no problem!
Thank you @nf-s
Closed by https://github.com/TerriaJS/terriajs/pull/5247
How we determine WMS legends (in order)
style
is undefined, and server doesn't support GetLegendGraphic
, we must select first style as default - as there is no way to know what the default style is, and to request a legend for itstyle
is is set and it has a legendUrl
-> use it!GetLegendGraphic
, we can request a legend (with or without style
parameter)
Paul Haesler on handling legends for ODC
Therefore: