settings global parameters for GetLegendGraphic

95 views
Skip to first unread message
Assigned to lorenzo...@geosolutionsgroup.com by me

c.morales

unread,
Sep 13, 2021, 10:45:54 AM9/13/21
to mapstore-users
Hi,
I need to modify for all layers the getLegend Graphic parameteres : width, height.
It is possible to do it by an user from the UI on a layer (for example width 30, height 20) but  i can't find a way to make these parameters global from a localConfig.json setting or from the TOC's plugin  of an application context.

Example of url from a custoised layer done by an user : 



1-    "legendStyle": { "maxWidth": "250%" } 
On what is referring the %, how to use it to have the same width and height as see before
2-  "WMSLegendOptions":  it's use only geoserver the vendor parameter LEGEND_OPTIONS, (https://docs.geoserver.org/latest/en/user/services/wms/get_legend_graphic/index.html) i tried with columnheight and rowwidth parameters but without effect.


How can i do ?

Lorenzo Natali

unread,
Sep 14, 2021, 6:29:31 AM9/14/21
to mapstore-users
Hi, 
The configuration you need are  legendWidth  and legendHeight inside layerOptions.legendOptions
cfg: {
   layerOptions: { 
      legendOptions: { legendWidth: 12, legendHeight: 12}
  }
}
I opened this pull request to improve documentation, adding these settings that were missing. 
thank you for sharing.

c.morales

unread,
Sep 15, 2021, 8:57:52 AM9/15/21
to mapstore-users
Thank you vey much, it works well. 
I applied it on our instances in localConfig.json :


"layerOptions": {
   "legendOptions": {
   "scaleDependent": true,
   "legendStyle": {
       "maxWidth": "250%"
    },
  "WMSLegendOptions": "forceLabels:on",
  "legendWidth": 30,
  "legendHeight": 20,

   "legendContainerStyle": {
        "overflowX": "auto"
     }
  } 
},  

legend.png

Julien Sabatier

unread,
Jun 1, 2022, 3:16:00 AM6/1/22
to mapstore-users
Hi,

I try to setup a context without TOC enabled, but with floatingLegend addon, and this conf is only available in TOC.

Is there a way to setup it also for FloatingLegend plugin ?

I try to setup an IFrame context that allow to add layers via URL to publish them on partners websites, but legends in FloatingLegend are too small. 
Reply all
Reply to author
Forward
0 new messages