[Geoserver-users] GetLegendGraphic transparent background

Hi all,

I am trying to set the background of a legend to transparent. In the documentation I can only find options to set a color as a background. Is there a way to set it to transparent?

Sample request:
https://geoserver.mapicture.com/geoserver/mapicture/wms?version=1.0.0&request=GetLegendGraphic&layer=mapicture:dt_private&style=cb_ylgnbu_6&format=image/png&width=22&height=22&legend_options=fontColor:0xFFFFFF;bgColor:1xFF69B4;

Thanks,

Uli

This transmission is intended for the named addressee(s) only and may contain confidential, sensitive or personal information and should be handled accordingly. Unless you are the named addressee (or authorised to receive it for the addressee) you may not copy or use it, or disclose it to anyone else. If you have received this transmission in error please notify the sender immediately. All email traffic sent to or from us, including without limitation all GCSX traffic, may be subject to recording and/or monitoring in accordance with relevant legislation.

···

Hi Uli,
Good question; makes sense as a feature now that I think about it and I’m surprised it’s not there.
Unfortunately however it doesn’t appear to be supported, or at least it’s not mentioned in the docs page for “legend_options”:

http://docs.geoserver.org/latest/en/user/services/wms/get_legend_graphic/legendgraphic.html#controlling-legend-appearance-with-legend-options

Which is more than the OGC specs include (they don’t have anything for styling of the legend itself).

So I fear the answer is no. Might be worth opening a JIRA for it as a feature request.

Cheers,
Jonathan

On 2 July 2014 10:44, Uli Strötz <ustroetz@anonymised.com> wrote:

Hi all,

I am trying to set the background of a legend to transparent. In the documentation I can only find options to set a color as a background. Is there a way to set it to transparent?

Sample request:
https://geoserver.mapicture.com/geoserver/mapicture/wms?version=1.0.0&request=GetLegendGraphic&layer=mapicture:dt_private&style=cb_ylgnbu_6&format=image/png&width=22&height=22&legend_options=fontColor:0xFFFFFF;bgColor:1xFF69B4;

Thanks,

Uli


Open source business process management suite built on Java and Eclipse
Turn processes into business applications with Bonita BPM Community Edition
Quickly connect people, data, and systems into organized workflows
Winner of BOSSIE, CODIE, OW2 and Gartner awards
http://p.sf.net/sfu/Bonitasoft


Geoserver-users mailing list
Geoserver-users@anonymised.comsts.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Hi Jonathan,

meanwhile I figured it out. There is an option to set the GetLegendGraphic request to transparent by simply adding “&TRANSPARENT=true”. So my request would look like this:

https://geoserver.mapicture.com/geoserver/mapicture/wms?version=1.0.0&request=GetLegendGraphic&layer=mapicture:dt_private&style=cb_ylgnbu_6&format=image/png&width=22&height=22&legend_options=fontColor:0xFFFFFF;&TRANSPARENT=true

We found this in the source code:
https://github.com/geoserver/geoserver/blob/master/src/wms/src/main/java/org/geoserver/wms/GetLegendGraphicRequest.java#L42

However it is not documented in the docs. Maybe this should be added to it.

Cheers,

Uli

···

On Wed, Jul 2, 2014 at 2:45 PM, Jonathan Moules <jonathanmoules@anonymised.com> wrote:

This transmission is intended for the named addressee(s) only and may contain confidential, sensitive or personal information and should be handled accordingly. Unless you are the named addressee (or authorised to receive it for the addressee) you may not copy or use it, or disclose it to anyone else. If you have received this transmission in error please notify the sender immediately. All email traffic sent to or from us, including without limitation all GCSX traffic, may be subject to recording and/or monitoring in accordance with relevant legislation.

Hi Uli,
Good question; makes sense as a feature now that I think about it and I’m surprised it’s not there.
Unfortunately however it doesn’t appear to be supported, or at least it’s not mentioned in the docs page for “legend_options”:

http://docs.geoserver.org/latest/en/user/services/wms/get_legend_graphic/legendgraphic.html#controlling-legend-appearance-with-legend-options

Which is more than the OGC specs include (they don’t have anything for styling of the legend itself).

So I fear the answer is no. Might be worth opening a JIRA for it as a feature request.

Cheers,
Jonathan

On 2 July 2014 10:44, Uli Strötz <ustroetz@anonymised.com> wrote:

Hi all,

I am trying to set the background of a legend to transparent. In the documentation I can only find options to set a color as a background. Is there a way to set it to transparent?

Sample request:
https://geoserver.mapicture.com/geoserver/mapicture/wms?version=1.0.0&request=GetLegendGraphic&layer=mapicture:dt_private&style=cb_ylgnbu_6&format=image/png&width=22&height=22&legend_options=fontColor:0xFFFFFF;bgColor:1xFF69B4;

Thanks,

Uli


Open source business process management suite built on Java and Eclipse
Turn processes into business applications with Bonita BPM Community Edition
Quickly connect people, data, and systems into organized workflows
Winner of BOSSIE, CODIE, OW2 and Gartner awards
http://p.sf.net/sfu/Bonitasoft


Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users