SLD <title> problem

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

SLD <title> problem

Andreas Forø Tollefsen
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 <title> tag in the SLD file.
However, when adding <title> 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 <title> tag.

What is the issue here? I have seen a number of SLD files that has the <title> 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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geoserver-users

working.sld (8K) Download Attachment
notworking.sld (8K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: SLD <title> problem

Andreas Forø Tollefsen

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?

8. aug. 2014 08:17 skrev "Andreas Forø Tollefsen" <[hidden email]> 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 <title> tag in the SLD file.
However, when adding <title> 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 <title> tag.

What is the issue here? I have seen a number of SLD files that has the <title> 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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geoserver-users
Reply | Threaded
Open this post in threaded view
|

Re: SLD <title> problem

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

For which the SLD structure looks like:

<?xml version="1.0" encoding="UTF-8"?>
<StyledLayerDescriptor xmlns="http://www.opengis.net/sld" xmlns:ogc="http://www.opengis.net/ogc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xsi:schemaLocation="http://www.opengis.net/sld http://schemas.opengis.net/sld/1.1.0/StyledLayerDescriptor.xsd" xmlns:se="http://www.opengis.net/se">
  <NamedLayer>
    <se:Name>Topographic Area - General Styling</se:Name>
    <UserStyle>
      <se:FeatureTypeStyle>
        
        <!-- Interim solution for not-filling properly -->
        <se:Rule>
          <se:Name>Green Stuff 1</se:Name>
          <ogc:Filter>
            <ogc:PropertyIsEqualTo>
              <ogc:Function name="in10">
                <ogc:PropertyName>OSMMSTYLE_NAME</ogc:PropertyName>
                <ogc:Literal>nonconiferousTreesAndScatteredRocksPattern</ogc:Literal>
                <ogc:Literal>roughGrassAndRocksPattern</ogc:Literal>
                <ogc:Literal>rocksRoughGrassAndBouldersPattern</ogc:Literal>
                <ogc:Literal>coniferousTreesAndScatteredRocksPattern</ogc:Literal>
                <ogc:Literal>roughGrassScatteredRocksAndHeathPattern</ogc:Literal>
                <ogc:Literal>roughGrassScatteredRocksAndBouldersPattern</ogc:Literal>
                <ogc:Literal>heathAndScatteredRocksPattern</ogc:Literal>
                <ogc:Literal>roughtGrassAndHeathPattern</ogc:Literal>
                <ogc:Literal>roughGrassAndScatteredRocksPattern</ogc:Literal>
                <ogc:Literal>roughGrassScatteredRocksAndScatteredBoulders</ogc:Literal>
              </ogc:Function>
              <ogc:Literal>true</ogc:Literal>
            </ogc:PropertyIsEqualTo>
          </ogc:Filter>
          <se:MaxScaleDenominator>5100</se:MaxScaleDenominator>
          <se:PolygonSymbolizer>
            <se:Fill>
              <se:SvgParameter name="fill">#C2F2AA</se:SvgParameter>
            </se:Fill>
          </se:PolygonSymbolizer>
        </se:Rule>
...
      </se:FeatureTypeStyle>
      
    </UserStyle>
  </NamedLayer>
</StyledLayerDescriptor>


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.

Cheers,
Jonathan



On 8 August 2014 09:53, Andreas Forø Tollefsen <[hidden email]> 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?

8. aug. 2014 08:17 skrev "Andreas Forø Tollefsen" <[hidden email]> 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 <title> tag in the SLD file.
However, when adding <title> 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 <title> tag.

What is the issue here? I have seen a number of SLD files that has the <title> 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
[hidden email]
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.
------------------------------------------------------------------------------
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geoserver-users
Reply | Threaded
Open this post in threaded view
|

Re: SLD <title> problem

Andreas Forø Tollefsen
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 <[hidden email]>:
Hi Andreas,
  I get this sort of functionality in some of my legends, i.e.:

For which the SLD structure looks like:

<?xml version="1.0" encoding="UTF-8"?>
<StyledLayerDescriptor xmlns="http://www.opengis.net/sld" xmlns:ogc="http://www.opengis.net/ogc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xsi:schemaLocation="http://www.opengis.net/sld http://schemas.opengis.net/sld/1.1.0/StyledLayerDescriptor.xsd" xmlns:se="http://www.opengis.net/se">
  <NamedLayer>
    <se:Name>Topographic Area - General Styling</se:Name>
    <UserStyle>
      <se:FeatureTypeStyle>
        
        <!-- Interim solution for not-filling properly -->
        <se:Rule>
          <se:Name>Green Stuff 1</se:Name>
          <ogc:Filter>
            <ogc:PropertyIsEqualTo>
              <ogc:Function name="in10">
                <ogc:PropertyName>OSMMSTYLE_NAME</ogc:PropertyName>
                <ogc:Literal>nonconiferousTreesAndScatteredRocksPattern</ogc:Literal>
                <ogc:Literal>roughGrassAndRocksPattern</ogc:Literal>
                <ogc:Literal>rocksRoughGrassAndBouldersPattern</ogc:Literal>
                <ogc:Literal>coniferousTreesAndScatteredRocksPattern</ogc:Literal>
                <ogc:Literal>roughGrassScatteredRocksAndHeathPattern</ogc:Literal>
                <ogc:Literal>roughGrassScatteredRocksAndBouldersPattern</ogc:Literal>
                <ogc:Literal>heathAndScatteredRocksPattern</ogc:Literal>
                <ogc:Literal>roughtGrassAndHeathPattern</ogc:Literal>
                <ogc:Literal>roughGrassAndScatteredRocksPattern</ogc:Literal>
                <ogc:Literal>roughGrassScatteredRocksAndScatteredBoulders</ogc:Literal>
              </ogc:Function>
              <ogc:Literal>true</ogc:Literal>
            </ogc:PropertyIsEqualTo>
          </ogc:Filter>
          <se:MaxScaleDenominator>5100</se:MaxScaleDenominator>
          <se:PolygonSymbolizer>
            <se:Fill>
              <se:SvgParameter name="fill">#C2F2AA</se:SvgParameter>
            </se:Fill>
          </se:PolygonSymbolizer>
        </se:Rule>
...
      </se:FeatureTypeStyle>
      
    </UserStyle>
  </NamedLayer>
</StyledLayerDescriptor>


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.

Cheers,
Jonathan



On 8 August 2014 09:53, Andreas Forø Tollefsen <[hidden email]> 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?

8. aug. 2014 08:17 skrev "Andreas Forø Tollefsen" <[hidden email]> 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 <title> tag in the SLD file.
However, when adding <title> 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 <title> tag.

What is the issue here? I have seen a number of SLD files that has the <title> 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
[hidden email]
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.


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

_______________________________________________
Geoserver-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geoserver-users
Reply | Threaded
Open this post in threaded view
|

Re: SLD <title> problem

Jonathan Moules-2
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 <[hidden email]> 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 <[hidden email]>:
Hi Andreas,
  I get this sort of functionality in some of my legends, i.e.:

For which the SLD structure looks like:

<?xml version="1.0" encoding="UTF-8"?>
<StyledLayerDescriptor xmlns="http://www.opengis.net/sld" xmlns:ogc="http://www.opengis.net/ogc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xsi:schemaLocation="http://www.opengis.net/sld http://schemas.opengis.net/sld/1.1.0/StyledLayerDescriptor.xsd" xmlns:se="http://www.opengis.net/se">
  <NamedLayer>
    <se:Name>Topographic Area - General Styling</se:Name>
    <UserStyle>
      <se:FeatureTypeStyle>
        
        <!-- Interim solution for not-filling properly -->
        <se:Rule>
          <se:Name>Green Stuff 1</se:Name>
          <ogc:Filter>
            <ogc:PropertyIsEqualTo>
              <ogc:Function name="in10">
                <ogc:PropertyName>OSMMSTYLE_NAME</ogc:PropertyName>
                <ogc:Literal>nonconiferousTreesAndScatteredRocksPattern</ogc:Literal>
                <ogc:Literal>roughGrassAndRocksPattern</ogc:Literal>
                <ogc:Literal>rocksRoughGrassAndBouldersPattern</ogc:Literal>
                <ogc:Literal>coniferousTreesAndScatteredRocksPattern</ogc:Literal>
                <ogc:Literal>roughGrassScatteredRocksAndHeathPattern</ogc:Literal>
                <ogc:Literal>roughGrassScatteredRocksAndBouldersPattern</ogc:Literal>
                <ogc:Literal>heathAndScatteredRocksPattern</ogc:Literal>
                <ogc:Literal>roughtGrassAndHeathPattern</ogc:Literal>
                <ogc:Literal>roughGrassAndScatteredRocksPattern</ogc:Literal>
                <ogc:Literal>roughGrassScatteredRocksAndScatteredBoulders</ogc:Literal>
              </ogc:Function>
              <ogc:Literal>true</ogc:Literal>
            </ogc:PropertyIsEqualTo>
          </ogc:Filter>
          <se:MaxScaleDenominator>5100</se:MaxScaleDenominator>
          <se:PolygonSymbolizer>
            <se:Fill>
              <se:SvgParameter name="fill">#C2F2AA</se:SvgParameter>
            </se:Fill>
          </se:PolygonSymbolizer>
        </se:Rule>
...
      </se:FeatureTypeStyle>
      
    </UserStyle>
  </NamedLayer>
</StyledLayerDescriptor>


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.

Cheers,
Jonathan



On 8 August 2014 09:53, Andreas Forø Tollefsen <[hidden email]> 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?

8. aug. 2014 08:17 skrev "Andreas Forø Tollefsen" <[hidden email]> 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 <title> tag in the SLD file.
However, when adding <title> 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 <title> tag.

What is the issue here? I have seen a number of SLD files that has the <title> 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
[hidden email]
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.



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.
------------------------------------------------------------------------------

_______________________________________________
Geoserver-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geoserver-users
Reply | Threaded
Open this post in threaded view
|

Re: SLD <title> problem

geowolf
On Mon, Aug 11, 2014 at 12:06 PM, Jonathan Moules <[hidden email]> 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


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

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

_______________________________________________
Geoserver-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geoserver-users