hajkmap / Hajk

A modern, full-featured OpenLayers based map viewer and editor
MIT License
122 stars 45 forks source link

Add a clever way to generate GetLegendGraphic URL #918

Open jacobwod opened 2 years ago

jacobwod commented 2 years ago

When editing a WMS layer in Admin UI, there's an option to set legendIcon for each given layer (and sublayers):

image


While useful as-is, it can easily become cumbersome when the amount of sublayers increases:

Skärmavbild 2021-11-19 kl  15 09 10


However, the URL for each layer follows (oftentimes) a pattern. Normally we would like to send some options to the WMS service (e.g. to disable the labelling on icon graphic), or request some custom size of the icon.

We will probably end up with something like this:

layer1: https://somewhere.overthe.rainbown/wmsserver?SERVICE=WMS&REQUEST=GetLegendGraphic&VERSION=1.1.0&FORMAT=image/png&LAYER=layer1&LAYERTITLE=false&RULELABEL=false

layer2: https://somewhere.overthe.rainbown/wmsserver?SERVICE=WMS&REQUEST=GetLegendGraphic&VERSION=1.1.0&FORMAT=image/png&LAYER=layer2&LAYERTITLE=false&RULELABEL=false

layerN: https://somewhere.overthe.rainbown/wmsserver?SERVICE=WMS&REQUEST=GetLegendGraphic&VERSION=1.1.0&FORMAT=image/png&LAYER=layerN&LAYERTITLE=false&RULELABEL=false

We could make the administration much easier if we could expose some parameters in the Admin UI, while determine the other ones (URL to the service, layer's name) from the layer's existing definition.

Hallbergs commented 2 years ago

I like it! However, maybe we should hold off implementation until we're building the new Admin UI?

jacobwod commented 2 years ago

Definitively, as the most of it will go there - no point in doing it now!