On Fri, Jul 15, 2011 at 1:41 AM, Adam Ratcliffe <
[email protected]> wrote:

> I believe I am using "library mode", that's triggered when both the SLD and
> LAYERS parameters are included in the request right?


Nope, &sld and layers are all that's needed. From the spec:

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

To make the HTTP-GET methods more practical for use, the SLD can also be
used in
one of two different modes depending on whether the LAYERS parameter is
present in the
request. If it is not present, then all layers identified in the SLD
document are rendered
with all defined styles, which is equivalent to the XML-POST method of
usage. If the
LAYERS parameter is present, then only the layers identified by that
parameter are
rendered and the SLD is used as a “style library”.

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


> The correct UserStyle is being applied from the external SLD as the
> PointSymbolizer from the UserStyle is being used and even the TextSymbolizer
> works if I use a static string instead of referencing a feature property.
>
> Here's an example request and the full SLD:
>
>
> http://localhost:8080/geoserver/wms?TILED=true&TRANSPARENT=true&FORMAT=image%2Fpng&SLD=http%3A%2F%2Flocalhost%2Fprojects%2Fol-wfs%2Fwww%2Fcompanies%2F1%2Fstyles.sld&DC=1310686489420&LAYERS=gis_geosmart%3ATest2&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&SRS=EPSG%3A900913&BBOX=19450471.961275,-4441908.5877125,19470039.840512,-4422340.708475&WIDTH=256&HEIGHT=256
>
> <sld:StyledLayerDescriptor xmlns:sld="http://www.opengis.net/sld";
> version="1.0.0" xsi:schemaLocation="http://www.opengis.net/sld
> http://schemas.opengis.net/sld/1.0.0/StyledLayerDescriptor.xsd";
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xmlns:ogc="
> http://www.opengis.net/ogc"; xmlns:gml="http://www.opengis.net/gml";>
>  <sld:NamedLayer>
>    <sld:Name>gis_geosmart:Test2</sld:Name>
>    <sld:UserStyle>
>      <sld:Name>default</sld:Name>
>      <sld:FeatureTypeStyle>
>        <sld:Rule>
>          <sld:PointSymbolizer>
>            <sld:Graphic>
>              <sld:Mark>
>                <sld:WellKnownName>circle</sld:WellKnownName>
>                <sld:Fill>
>                  <sld:CssParameter name="fill">#3886D9</sld:CssParameter>
>                  <sld:CssParameter
> name="fill-opacity">0.4</sld:CssParameter>
>                </sld:Fill>
>                <sld:Stroke>
>                  <sld:CssParameter name="stroke">#3886D9</sld:CssParameter>
>                  <sld:CssParameter
> name="stroke-opacity">1</sld:CssParameter>
>                  <sld:CssParameter name="stroke-width">1</sld:CssParameter>
>                </sld:Stroke>
>              </sld:Mark>
>              <sld:Size>12</sld:Size>
>            </sld:Graphic>
>          </sld:PointSymbolizer>
>          <sld:TextSymbolizer>
>            <sld:Label>
>               <ogc:PropertyName>Type_CODE</ogc:PropertyName>
>             </sld:Label>
>            <sld:Fill>
>              <sld:CssParameter name="fill">#000000</sld:CssParameter>
>            </sld:Fill>
>          </sld:TextSymbolizer>
>        </sld:Rule>
>      </sld:FeatureTypeStyle>
>    </sld:UserStyle>
>    <sld:UserStyle>
>      <sld:Name>select</sld:Name>
>      <sld:FeatureTypeStyle>
>        <sld:Rule>
>          <sld:PointSymbolizer>
>            <sld:Graphic>
>              <sld:Mark>
>                <sld:WellKnownName>circle</sld:WellKnownName>
>                <sld:Fill>
>                  <sld:CssParameter name="fill">#0000FF</sld:CssParameter>
>                  <sld:CssParameter
> name="fill-opacity">0.4</sld:CssParameter>
>                </sld:Fill>
>                <sld:Stroke>
>                  <sld:CssParameter name="stroke">#0000FF</sld:CssParameter>
>                  <sld:CssParameter
> name="stroke-opacity">1</sld:CssParameter>
>                  <sld:CssParameter name="stroke-width">1</sld:CssParameter>
>                </sld:Stroke>
>              </sld:Mark>
>              <sld:Size>12</sld:Size>
>            </sld:Graphic>
>          </sld:PointSymbolizer>
>        </sld:Rule>
>      </sld:FeatureTypeStyle>
>    </sld:UserStyle>
>    <sld:UserStyle>
>      <sld:Name>temporary</sld:Name>
>      <sld:FeatureTypeStyle>
>        <sld:Rule>
>          <sld:PointSymbolizer>
>            <sld:Graphic>
>              <sld:Mark>
>                <sld:WellKnownName>circle</sld:WellKnownName>
>                <sld:Fill>
>                  <sld:CssParameter name="fill">#A80510</sld:CssParameter>
>                  <sld:CssParameter
> name="fill-opacity">0.4</sld:CssParameter>
>                </sld:Fill>
>                <sld:Stroke>
>                  <sld:CssParameter name="stroke">#A80510</sld:CssParameter>
>                  <sld:CssParameter
> name="stroke-opacity">1</sld:CssParameter>
>                  <sld:CssParameter name="stroke-width">1</sld:CssParameter>
>                </sld:Stroke>
>              </sld:Mark>
>              <sld:Size>12</sld:Size>
>            </sld:Graphic>
>          </sld:PointSymbolizer>
>        </sld:Rule>
>      </sld:FeatureTypeStyle>
>    </sld:UserStyle>
>    <sld:UserStyle>
>      <sld:FeatureTypeStyle/>
>    </sld:UserStyle>
>  </sld:NamedLayer>
> </sld:StyledLayerDescriptor>
>
>
The above won't work in library mode. When in library mode the code will
look in the sld in turn for
each layer in layers.
If you specified a style name for that layer, it will pick the userstyle
with that name under the current
layer. If you did not specify a style the following rule applies (again,
citing verbatim from the spec):

----
The IsDefault element identifies whether a style is the default style of a
layer, for use
in SLD ‘library mode’ when rendering or for storing inside of a map server.
IsDefault
uses “1” for true and “0” for false. The default value is “0”.
----

Unfortunately you don't have any style there marked as default, so the style
library will get ignored
and the built-in default style in the server will be used instead

Cheers
Andrea


-- 
-------------------------------------------------------
Ing. Andrea Aime
GeoSolutions S.A.S.
Tech lead

Via Poggio alle Viti 1187
55054  Massarosa (LU)
Italy

phone: +39 0584 962313
fax:      +39 0584 962313

http://www.geo-solutions.it
http://geo-solutions.blogspot.com/
http://www.youtube.com/user/GeoSolutionsIT
http://www.linkedin.com/in/andreaaime
http://twitter.com/geowolf

-------------------------------------------------------
------------------------------------------------------------------------------
AppSumo Presents a FREE Video for the SourceForge Community by Eric 
Ries, the creator of the Lean Startup Methodology on "Lean Startup 
Secrets Revealed." This video shows you how to validate your ideas, 
optimize your ideas and identify your business strategy.
http://p.sf.net/sfu/appsumosfdev2dev
_______________________________________________
Geoserver-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to