Hi Andrea,
Thanks for the help I now have library mode working correctly. The problem I
had was that I was passing the layer name prefixed with the namespace in the
WMS 'layers' parameter but was using the un-prefixed name for the SLD's
NamedLayer.
I'm now trying to restructure my SLD as all symbolizers declared for the
UserStyle are being applied to my features e.g. a polygon has the
LineSymbolizer applied for its stroke and the PointSymbolizer applied to its
centroid.
I've tried using the non-standard geometryType function as shown in the SLD
excerpt below but am still seeing all symbolizers applied. Am I missing
something obvious here?
Cheers
Adam
...
<sld:UserStyle>
<sld:Name>default</sld:Name>
<sld:FeatureTypeStyle>
<sld:Rule>
<ogc:PropertyIsEqualsTo>
<ogc:Function name="geometryType">
<ogc:PropertyName>wkb_geometry</ogc:PropertyName>
</ogc:Function>
<ogc:Literal>Point</ogc:Literal>
</ogc:PropertyIsEqualsTo>
<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:Rule>
<sld:Rule>
<ogc:PropertyIsEqualsTo>
<ogc:Function name="geometryType">
<ogc:PropertyName>wkb_geometry</ogc:PropertyName>
</ogc:Function>
<ogc:Literal>LineString</ogc:Literal>
</ogc:PropertyIsEqualsTo>
<sld:LineSymbolizer>
<sld:Stroke>
<sld:CssParameter name="stroke">#3886D9</sld:CssParameter>
<sld:CssParameter name="stroke-opacity">1</sld:CssParameter>
<sld:CssParameter name="stroke-width">2</sld:CssParameter>
</sld:Stroke>
</sld:LineSymbolizer>
</sld:Rule>
<sld:Rule>
<ogc:PropertyIsEqualsTo>
<ogc:Function name="geometryType">
<ogc:PropertyName>wkb_geometry</ogc:PropertyName>
</ogc:Function>
<ogc:Literal>Polygon</ogc:Literal>
</ogc:PropertyIsEqualsTo>
<sld:PolygonSymbolizer>
<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:PolygonSymbolizer>
</sld:Rule>
</sld:FeatureTypeStyle>
</sld:UserStyle>
Cheers
Adam
On 27/11/2010, at 10:47 PM, Andrea Aime wrote:
> On Wed, Nov 24, 2010 at 5:48 AM, Adam Ratcliffe <[email protected]> wrote:
>> Hi,
>>
>> I would like to pass a reference to an external SLD with a GetMap request.
>> The SLD is created using an OpenLayers client and contains a <NamedLayer>
>> element for each layer in the target namespace, and within each <NamedLayer>
>> element there are separate <UserStyle> elements for the various rendering
>> intents supported by OpenLayers.
>>
>> Each GetMap request will be for a single layer and should use the 'default'
>> <UserStyle>.
>>
>> I can pass a reference to the SLD using the 'SLD' parameter but I don't know
>> how to target a specific <UserStyle> in the SLD - if that is indeed
>> possible. A sample SLD is shown below.
>
> What you need is library mode. You have to setup your SLD so that the
> named layers do match the layer names in the request, and then the
> &styles parameter can refer
> to any user style associated in the sld to the corresponding layer.
>
> However the SLD you reference by &SLD=... must be accessible to
> geoserver, meaning it should be possible to make an http connection
> from geoserver to that file
> and download it. I don't think this can be done using openlayers
> alone, the browser cannot act as a web server.
>
> An alternative is to send a POST request for each tile, but I don't
> think openlayers can do that either.
> Maybe a way is to use RESTConfig to statically add the file to the
> geoserver catalog, and then just refer it by name in the GetMap
> requests.
>
> Cheers
> Andrea
>
> -----------------------------------------------------
> Ing. Andrea Aime
> Senior Software Engineer
>
> GeoSolutions S.A.S.
> Via Poggio alle Viti 1187
> 55054 Massarosa (LU)
> Italy
>
> phone: +39 0584962313
> fax: +39 0584962313
>
> http://www.geo-solutions.it
> http://geo-solutions.blogspot.com/
> http://www.linkedin.com/in/andreaaime
> http://twitter.com/geowolf
>
> -----------------------------------------------------
------------------------------------------------------------------------------
Increase Visibility of Your 3D Game App & Earn a Chance To Win $500!
Tap into the largest installed PC base & get more eyes on your game by
optimizing for Intel(R) Graphics Technology. Get started today with the
Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs.
http://p.sf.net/sfu/intelisp-dev2dev
_______________________________________________
Geoserver-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-users