[Geoserver-users] SLD <title> problem

Hi,

I have a SLD file generated by QGIS to visualize a WMS layer.
This works without any problem.

However, when using GetLegendGraphics with attribution in OpenLayers, the legend comes up as expected, but without a title.
I have understood that this is likely to be due to a missing tag in the SLD file.
However, when adding to the SLD it is no longer possible to validate the SLD code.
I have attached two files, working.sld and notworking.sld.
The only difference is the adding of the tag.

What is the issue here? I have seen a number of SLD files that has the inserted, and not reporting issues.

Thanks.

Andreas

working.sld (5.98 KB)

notworking.sld (6.02 KB)

I tried with AtlasStyler. It included a title tag i could change. However, the title does not show over the legend.
Any suggestions or working examples?

  1. aug. 2014 08:17 skrev “Andreas Forø Tollefsen” <andreasft@anonymised.com…> følgende:

Hi,

I have a SLD file generated by QGIS to visualize a WMS layer.
This works without any problem.

However, when using GetLegendGraphics with attribution in OpenLayers, the legend comes up as expected, but without a title.
I have understood that this is likely to be due to a missing tag in the SLD file.
However, when adding to the SLD it is no longer possible to validate the SLD code.
I have attached two files, working.sld and notworking.sld.
The only difference is the adding of the tag.

What is the issue here? I have seen a number of SLD files that has the inserted, and not reporting issues.

Thanks.

Andreas

Hi Andreas,
I get this sort of functionality in some of my legends, i.e.:

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.

···

http://maps.warwickshire.gov.uk/gs/ows?TRANSPARENT=TRUE&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetLegendGraphic&EXCEPTIONS=application%2Fvnd.ogc.se_xml&LAYER=OS_MasterMap_Group_Traditional_Style&FORMAT=image%2Fpng&SCALE=4999.999998423737

For which the SLD structure looks like:

<?xml version="1.0" encoding="UTF-8"?> Topographic Area - General Styling

se:Rule
se:NameGreen Stuff 1</se:Name>
ogc:Filter
ogc:PropertyIsEqualTo
<ogc:Function name=“in10”>
ogc:PropertyNameOSMMSTYLE_NAME</ogc:PropertyName>
ogc:LiteralnonconiferousTreesAndScatteredRocksPattern</ogc:Literal>
ogc:LiteralroughGrassAndRocksPattern</ogc:Literal>
ogc:LiteralrocksRoughGrassAndBouldersPattern</ogc:Literal>
ogc:LiteralconiferousTreesAndScatteredRocksPattern</ogc:Literal>
ogc:LiteralroughGrassScatteredRocksAndHeathPattern</ogc:Literal>
ogc:LiteralroughGrassScatteredRocksAndBouldersPattern</ogc:Literal>
ogc:LiteralheathAndScatteredRocksPattern</ogc:Literal>
ogc:LiteralroughtGrassAndHeathPattern</ogc:Literal>
ogc:LiteralroughGrassAndScatteredRocksPattern</ogc:Literal>
ogc:LiteralroughGrassScatteredRocksAndScatteredBoulders</ogc:Literal>
</ogc:Function>
ogc:Literaltrue</ogc:Literal>
</ogc:PropertyIsEqualTo>
</ogc:Filter>
se:MaxScaleDenominator5100</se:MaxScaleDenominator>
se:PolygonSymbolizer
se:Fill
<se:SvgParameter name=“fill”>#C2F2AA</se:SvgParameter>
</se:Fill>
</se:PolygonSymbolizer>
</se:Rule>

</se:FeatureTypeStyle>

Note that the title you see at the top of the legend is actually the layer-group “Title”. It doesn’t appear anywhere in the SLD.

=====

Also, a suggestion - there is a PropertyIsBetween filter which you could use instead of your lessthan / greaterthan option.
http://docs.geoserver.org/latest/en/user/styling/sld-reference/filters.html#comparison-operators

Cheers,
Jonathan

On 8 August 2014 09:53, Andreas Forø Tollefsen <andreasft@anonymised.com> wrote:

I tried with AtlasStyler. It included a title tag i could change. However, the title does not show over the legend.
Any suggestions or working examples?

  1. aug. 2014 08:17 skrev “Andreas Forø Tollefsen” <andreasft@anonymised.com> følgende:

Hi,

I have a SLD file generated by QGIS to visualize a WMS layer.
This works without any problem.

However, when using GetLegendGraphics with attribution in OpenLayers, the legend comes up as expected, but without a title.
I have understood that this is likely to be due to a missing tag in the SLD file.
However, when adding to the SLD it is no longer possible to validate the SLD code.
I have attached two files, working.sld and notworking.sld.
The only difference is the adding of the tag.

What is the issue here? I have seen a number of SLD files that has the inserted, and not reporting issues.

Thanks.

Andreas


Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world’s largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds


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

Hi Jonathan,

Thank you for your example SLD and the suggestion about the layer-group Title.
I tried to add my layer to a layer group, but I could not manage to get the title on top of the legend.
Should this title be added automatically when adding a layer that is stored in a layer group?

Thanks.

Andreas

···

2014-08-08 17:31 GMT+02:00 Jonathan Moules <jonathanmoules@anonymised.com…>:

Hi Andreas,
I get this sort of functionality in some of my legends, i.e.:

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.

http://maps.warwickshire.gov.uk/gs/ows?TRANSPARENT=TRUE&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetLegendGraphic&EXCEPTIONS=application%2Fvnd.ogc.se_xml&LAYER=OS_MasterMap_Group_Traditional_Style&FORMAT=image%2Fpng&SCALE=4999.999998423737

For which the SLD structure looks like:

<?xml version="1.0" encoding="UTF-8"?> Topographic Area - General Styling

se:Rule
se:NameGreen Stuff 1</se:Name>
ogc:Filter
ogc:PropertyIsEqualTo
<ogc:Function name=“in10”>
ogc:PropertyNameOSMMSTYLE_NAME</ogc:PropertyName>
ogc:LiteralnonconiferousTreesAndScatteredRocksPattern</ogc:Literal>
ogc:LiteralroughGrassAndRocksPattern</ogc:Literal>
ogc:LiteralrocksRoughGrassAndBouldersPattern</ogc:Literal>
ogc:LiteralconiferousTreesAndScatteredRocksPattern</ogc:Literal>
ogc:LiteralroughGrassScatteredRocksAndHeathPattern</ogc:Literal>
ogc:LiteralroughGrassScatteredRocksAndBouldersPattern</ogc:Literal>
ogc:LiteralheathAndScatteredRocksPattern</ogc:Literal>
ogc:LiteralroughtGrassAndHeathPattern</ogc:Literal>
ogc:LiteralroughGrassAndScatteredRocksPattern</ogc:Literal>
ogc:LiteralroughGrassScatteredRocksAndScatteredBoulders</ogc:Literal>
</ogc:Function>
ogc:Literaltrue</ogc:Literal>
</ogc:PropertyIsEqualTo>
</ogc:Filter>
se:MaxScaleDenominator5100</se:MaxScaleDenominator>
se:PolygonSymbolizer
se:Fill
<se:SvgParameter name=“fill”>#C2F2AA</se:SvgParameter>
</se:Fill>
</se:PolygonSymbolizer>
</se:Rule>

</se:FeatureTypeStyle>

Note that the title you see at the top of the legend is actually the layer-group “Title”. It doesn’t appear anywhere in the SLD.

=====

Also, a suggestion - there is a PropertyIsBetween filter which you could use instead of your lessthan / greaterthan option.
http://docs.geoserver.org/latest/en/user/styling/sld-reference/filters.html#comparison-operators

Cheers,
Jonathan

On 8 August 2014 09:53, Andreas Forø Tollefsen <andreasft@anonymised.com> wrote:

I tried with AtlasStyler. It included a title tag i could change. However, the title does not show over the legend.
Any suggestions or working examples?

  1. aug. 2014 08:17 skrev “Andreas Forø Tollefsen” <andreasft@anonymised.com> følgende:

Hi,

I have a SLD file generated by QGIS to visualize a WMS layer.
This works without any problem.

However, when using GetLegendGraphics with attribution in OpenLayers, the legend comes up as expected, but without a title.
I have understood that this is likely to be due to a missing tag in the SLD file.
However, when adding to the SLD it is no longer possible to validate the SLD code.
I have attached two files, working.sld and notworking.sld.
The only difference is the adding of the tag.

What is the issue here? I have seen a number of SLD files that has the inserted, and not reporting issues.

Thanks.

Andreas


Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world’s largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds


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

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 Andreas,
Hmm. Mine happens automatically. GeoServer picks up the Layer names and uses them for the Legend titles, at least for me. I didn’t do anything special so I’m not sure what to suggest, maybe someone else has a notion.

Cheers,
Jonathan

On 9 August 2014 19:14, Andreas Forø Tollefsen <andreasft@anonymised.com> wrote:

Hi Jonathan,

Thank you for your example SLD and the suggestion about the layer-group Title.
I tried to add my layer to a layer group, but I could not manage to get the title on top of the legend.
Should this title be added automatically when adding a layer that is stored in a layer group?

Thanks.

Andreas

2014-08-08 17:31 GMT+02:00 Jonathan Moules <jonathanmoules@anonymised.com…>:

Hi Andreas,
I get this sort of functionality in some of my legends, i.e.:

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.

http://maps.warwickshire.gov.uk/gs/ows?TRANSPARENT=TRUE&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetLegendGraphic&EXCEPTIONS=application%2Fvnd.ogc.se_xml&LAYER=OS_MasterMap_Group_Traditional_Style&FORMAT=image%2Fpng&SCALE=4999.999998423737

For which the SLD structure looks like:

<?xml version="1.0" encoding="UTF-8"?> Topographic Area - General Styling

se:Rule
se:NameGreen Stuff 1</se:Name>
ogc:Filter
ogc:PropertyIsEqualTo
<ogc:Function name=“in10”>
ogc:PropertyNameOSMMSTYLE_NAME</ogc:PropertyName>
ogc:LiteralnonconiferousTreesAndScatteredRocksPattern</ogc:Literal>
ogc:LiteralroughGrassAndRocksPattern</ogc:Literal>
ogc:LiteralrocksRoughGrassAndBouldersPattern</ogc:Literal>
ogc:LiteralconiferousTreesAndScatteredRocksPattern</ogc:Literal>
ogc:LiteralroughGrassScatteredRocksAndHeathPattern</ogc:Literal>
ogc:LiteralroughGrassScatteredRocksAndBouldersPattern</ogc:Literal>
ogc:LiteralheathAndScatteredRocksPattern</ogc:Literal>
ogc:LiteralroughtGrassAndHeathPattern</ogc:Literal>
ogc:LiteralroughGrassAndScatteredRocksPattern</ogc:Literal>
ogc:LiteralroughGrassScatteredRocksAndScatteredBoulders</ogc:Literal>
</ogc:Function>
ogc:Literaltrue</ogc:Literal>
</ogc:PropertyIsEqualTo>
</ogc:Filter>
se:MaxScaleDenominator5100</se:MaxScaleDenominator>
se:PolygonSymbolizer
se:Fill
<se:SvgParameter name=“fill”>#C2F2AA</se:SvgParameter>
</se:Fill>
</se:PolygonSymbolizer>
</se:Rule>

</se:FeatureTypeStyle>

Note that the title you see at the top of the legend is actually the layer-group “Title”. It doesn’t appear anywhere in the SLD.

=====

Also, a suggestion - there is a PropertyIsBetween filter which you could use instead of your lessthan / greaterthan option.
http://docs.geoserver.org/latest/en/user/styling/sld-reference/filters.html#comparison-operators

Cheers,
Jonathan

On 8 August 2014 09:53, Andreas Forø Tollefsen <andreasft@anonymised.com> wrote:

I tried with AtlasStyler. It included a title tag i could change. However, the title does not show over the legend.
Any suggestions or working examples?

  1. aug. 2014 08:17 skrev “Andreas Forø Tollefsen” <andreasft@anonymised.com> følgende:

Hi,

I have a SLD file generated by QGIS to visualize a WMS layer.
This works without any problem.

However, when using GetLegendGraphics with attribution in OpenLayers, the legend comes up as expected, but without a title.
I have understood that this is likely to be due to a missing tag in the SLD file.
However, when adding to the SLD it is no longer possible to validate the SLD code.
I have attached two files, working.sld and notworking.sld.
The only difference is the adding of the tag.

What is the issue here? I have seen a number of SLD files that has the inserted, and not reporting issues.

Thanks.

Andreas


Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world’s largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds


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

On Mon, Aug 11, 2014 at 12:06 PM, Jonathan Moules <
jonathanmoules@anonymised.com> wrote:

Hi Andreas,
Hmm. Mine happens automatically. GeoServer picks up the Layer names and
uses them for the Legend titles, at least for me. I didn't do anything
special so I'm not sure what to suggest, maybe someone else has a notion.

Yes, in SLD 1.1 Rule does have a Name, but there is no title tag. Using
name should just work:

<xsd:complexType name="RuleType">
<xsd:sequence>
<xsd:element ref="se:Name" minOccurs="0"/>
<xsd:element ref="se:Description" minOccurs="0"/>
<xsd:element ref="se:LegendGraphic" minOccurs="0"/>
<xsd:choice minOccurs="0">
<xsd:element ref="ogc:Filter"/>
<xsd:element ref="se:ElseFilter"/>
</xsd:choice>
<xsd:element ref="se:MinScaleDenominator" minOccurs="0"/>
<xsd:element ref="se:MaxScaleDenominator" minOccurs="0"/>
<xsd:element ref="se:Symbolizer" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>

Maybe I'm misunderstanding the issue.

Cheers
Andrea

--

GeoServer Professional Services from the experts! Visit
http://goo.gl/NWWaa2 for more information.

Ing. Andrea Aime
@geowolf
Technical Lead

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549

http://www.geo-solutions.it
http://twitter.com/geosolutions_it

-------------------------------------------------------