TerriaJS / terriajs

A library for building rich, web-based geospatial data platforms.
https://terria.io
Apache License 2.0
1.16k stars 360 forks source link

GetLegendGraphic incorrect display error #7184

Open mayleendv19 opened 3 months ago

mayleendv19 commented 3 months ago

I have tried to display the correct legend in terria But I still can't achieve it.

LINK: https://www.geoportaligm.gob.ec/terria#CA_BAHIA I have 5 groups of which there are 11 layers, 9 of them have general styles or legends and they are the ones that appear by default.

For example, in the city of Bahia, in the Soils category, the general legend is displayed. image

But I need a style defined for said city to appear as follows: image

Under the query: https://www.geoportaligm.gob.ec/igm_afc/igm_ca2022/ows?service=WMS&version=1.3.0&request=GetLegendGraphic&format=image/png&width=20&height=20&layer=v_suelo_a&style=stl_bahia_ttdp

This is my JSON file: CA_BAHIA_N.json

I tried to add the legend using a URL as follows but it reflects error: "legendUrls": { "mimeType": "image/png", "url": "https://www.geoportaligm.gob.ec/igm_afc/igm_ca2022/ows?service=WMS&version=1.3.0&request=GetLegendGraphic&format=image/png&width=20&height=20&layer=v_suelo_a&style=stl_bahia_ttdp" },

na9da commented 1 month ago

@mayleendv19

Have you got this working? I see that in your new CA_BAHIA.json file you have changed the legends config to the following which looks correct to me and seems to be working the way you want.

"legends": [
 {
  "urlMimeType": "image/png",
  "url": "https://www.geoportaligm.gob.ec/igm_afc/igm_ca2022/ows?service=WMS&version=1.3.0&request=GetLegendGraphic&format=image/png&width=20&height=20&layer=v_suelo_a&style=igm_ca22:stl_bahia_ttdp"
 }
]