[Geoserver-users] Legend Title

Hello All, hopefully someone has a quick and easy answer to this;

I'm looking to add title to our legends, but unable to get it working
properly. What is required for a legend to have a title like the
following: http://docs.geoserver.org/latest/en/user/_images/decoration.png

how is "USA Population" added to the legend here?

according to this page, it should be in the <Title> tag within the
<Rule> tag:
http://docs.geoserver.org/latest/en/user/community/css/tutorial.html#setting-titles-for-the-legend

but it won't work... tried adding several title tags just in case, and
can't get any variation to display the title. any help will be
appreciated, thanks in advance.

--
-andrés
[845.365.8986]

This is the style that was used for the decorations example:

https://github.com/geoserver/geoserver/blob/master/data/release/styles/popshade.sld

The title used for the legend is the title of the style itself, not the title of any specific rule. (Rule titles are used for the individual swatches.)

Legends might not work so well with CSS, the legend generation is pretty tightly based on the structure of SLD. But I’m interested to hear about how it goes if you try this out.


David Winslow
OpenGeo - http://opengeo.org/

On Wed, Jul 11, 2012 at 4:58 PM, Andrés González <agonzale@anonymised.com…2242…> wrote:

Hello All, hopefully someone has a quick and easy answer to this;

I’m looking to add title to our legends, but unable to get it working
properly. What is required for a legend to have a title like the
following: http://docs.geoserver.org/latest/en/user/_images/decoration.png

how is “USA Population” added to the legend here?

according to this page, it should be in the tag within the
tag:
http://docs.geoserver.org/latest/en/user/community/css/tutorial.html#setting-titles-for-the-legend

but it won’t work… tried adding several title tags just in case, and
can’t get any variation to display the title. any help will be
appreciated, thanks in advance.


-andrés
[845.365.8986]


Live Security Virtual Conference
Exclusive live event will cover all the ways today’s security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/


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

perhaps the question is if the getLegendGraphic request supports a title in the legend. i assumed that it would since the documentation for the css plugin states “GeoServer uses the title in auto-generating legend graphics”.

i have tried adding a title element to several fields – and have names on them as well. i never get any sort title on my legend, below is the url for the graphic, and the style is attached. am i perhaps missing a parameter in the request?

http://sedac.ciesin.columbia.edu/geoserver/wms?request=GetLegendGraphic&format=image%2Fpng&layer=grump-v1-population-density_2010&style=legend-title-test&width=15&height=15&legend_options=border:false;mx:0.05;my:0.02;dx:0.2;dy:0.07;fontSize:11;bandInfo:false;

legned-title-test.sld (1.45 KB)

···
-andrés
 [845.365.8986]

This is the style that was used for the decorations example:

https://github.com/geoserver/geoserver/blob/master/data/release/styles/popshade.sld

The title used for the legend is the title of the style itself, not the title of any specific rule. (Rule titles are used for the individual swatches.)

Legends might not work so well with CSS, the legend generation is pretty tightly based on the structure of SLD. But I’m interested to hear about how it goes if you try this out.


David Winslow
OpenGeo - http://opengeo.org/

On Wed, Jul 11, 2012 at 4:58 PM, Andrés González <agonzale@anonymised.com> wrote:

Hello All, hopefully someone has a quick and easy answer to this;

I’m looking to add title to our legends, but unable to get it working
properly. What is required for a legend to have a title like the
following: http://docs.geoserver.org/latest/en/user/_images/decoration.png

how is “USA Population” added to the legend here?

according to this page, it should be in the tag within the
tag:
http://docs.geoserver.org/latest/en/user/community/css/tutorial.html#setting-titles-for-the-legend

but it won’t work… tried adding several title tags just in case, and
can’t get any variation to display the title. any help will be
appreciated, thanks in advance.


-andrés
[845.365.8986]


Live Security Virtual Conference
Exclusive live event will cover all the ways today’s security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/


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

Those rule titles are used in labelling individual swatches. The bold, top-level title in the legend decoration appears to be added only when rendering decorations (ie, legends embedded in getmap responses, not getlegend requests.)

It’s done in the LegendDecoration class in the Java code, if you are willing to get your hands a little dirty I think it would make sense as a vendor option for GetLegendGraphic requests. I am not sure, but I think the WMS specification would require that it be disabled by default.


David Winslow
OpenGeo - http://opengeo.org/

On Thu, Jul 12, 2012 at 11:25 AM, Andrés González <agonzale@anonymised.com> wrote:

perhaps the question is if the getLegendGraphic request supports a title in the legend. i assumed that it would since the documentation for the css plugin states “GeoServer uses the title in auto-generating legend graphics”.

i have tried adding a title element to several fields – and have names on them as well. i never get any sort title on my legend, below is the url for the graphic, and the style is attached. am i perhaps missing a parameter in the request?

http://sedac.ciesin.columbia.edu/geoserver/wms?request=GetLegendGraphic&format=image%2Fpng&layer=grump-v1-population-density_2010&style=legend-title-test&width=15&height=15&legend_options=border:false;mx:0.05;my:0.02;dx:0.2;dy:0.07;fontSize:11;bandInfo:false;

-andrés
 [845.365.8986]

On 07/11/2012 05:21 PM, David Winslow wrote:

This is the style that was used for the decorations example:

https://github.com/geoserver/geoserver/blob/master/data/release/styles/popshade.sld

The title used for the legend is the title of the style itself, not the title of any specific rule. (Rule titles are used for the individual swatches.)

Legends might not work so well with CSS, the legend generation is pretty tightly based on the structure of SLD. But I’m interested to hear about how it goes if you try this out.


David Winslow
OpenGeo - http://opengeo.org/

On Wed, Jul 11, 2012 at 4:58 PM, Andrés González <agonzale@anonymised.com> wrote:

Hello All, hopefully someone has a quick and easy answer to this;

I’m looking to add title to our legends, but unable to get it working
properly. What is required for a legend to have a title like the
following: http://docs.geoserver.org/latest/en/user/_images/decoration.png

how is “USA Population” added to the legend here?

according to this page, it should be in the tag within the
tag:
http://docs.geoserver.org/latest/en/user/community/css/tutorial.html#setting-titles-for-the-legend

but it won’t work… tried adding several title tags just in case, and
can’t get any variation to display the title. any help will be
appreciated, thanks in advance.


-andrés
[845.365.8986]


Live Security Virtual Conference
Exclusive live event will cover all the ways today’s security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/


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

that’s good to know. perhaps i’ll submit a patch at a later time with the real intention being to render units in the legends, currently we are adding it to the label itself.

thanks for the help,

···
-andrés
 [845.365.8986]

Those rule titles are used in labelling individual swatches. The bold, top-level title in the legend decoration appears to be added only when rendering decorations (ie, legends embedded in getmap responses, not getlegend requests.)

It’s done in the LegendDecoration class in the Java code, if you are willing to get your hands a little dirty I think it would make sense as a vendor option for GetLegendGraphic requests. I am not sure, but I think the WMS specification would require that it be disabled by default.


David Winslow
OpenGeo - http://opengeo.org/

On Thu, Jul 12, 2012 at 11:25 AM, Andrés González <agonzale@anonymised.com> wrote:

perhaps the question is if the getLegendGraphic request supports a title in the legend. i assumed that it would since the documentation for the css plugin states “GeoServer uses the title in auto-generating legend graphics”.

i have tried adding a title element to several fields – and have names on them as well. i never get any sort title on my legend, below is the url for the graphic, and the style is attached. am i perhaps missing a parameter in the request?

http://sedac.ciesin.columbia.edu/geoserver/wms?request=GetLegendGraphic&format=image%2Fpng&layer=grump-v1-population-density_2010&style=legend-title-test&width=15&height=15&legend_options=border:false;mx:0.05;my:0.02;dx:0.2;dy:0.07;fontSize:11;bandInfo:false;

-andrés
 [845.365.8986]

On 07/11/2012 05:21 PM, David Winslow wrote:

This is the style that was used for the decorations example:

https://github.com/geoserver/geoserver/blob/master/data/release/styles/popshade.sld

The title used for the legend is the title of the style itself, not the title of any specific rule. (Rule titles are used for the individual swatches.)

Legends might not work so well with CSS, the legend generation is pretty tightly based on the structure of SLD. But I’m interested to hear about how it goes if you try this out.


David Winslow
OpenGeo - http://opengeo.org/

On Wed, Jul 11, 2012 at 4:58 PM, Andrés González <agonzale@anonymised.com> wrote:

Hello All, hopefully someone has a quick and easy answer to this;

I’m looking to add title to our legends, but unable to get it working
properly. What is required for a legend to have a title like the
following: http://docs.geoserver.org/latest/en/user/_images/decoration.png

how is “USA Population” added to the legend here?

according to this page, it should be in the tag within the
tag:
http://docs.geoserver.org/latest/en/user/community/css/tutorial.html#setting-titles-for-the-legend

but it won’t work… tried adding several title tags just in case, and
can’t get any variation to display the title. any help will be
appreciated, thanks in advance.


-andrés
[845.365.8986]


Live Security Virtual Conference
Exclusive live event will cover all the ways today’s security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/


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