Hi Andrea, I believe I am using "library mode", that's triggered when both the SLD and LAYERS parameters are included in the request right? 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> Cheers Adam ________________________________________ From: [email protected] [[email protected]] On Behalf Of Andrea Aime [[email protected]] Sent: 14 July 2011 22:14 To: Adam Ratcliffe Cc: [email protected] Subject: Re: [Geoserver-users] Problem with dynamic label values when using an external SLD On Thu, Jul 14, 2011 at 8:03 AM, Adam Ratcliffe <[email protected]> wrote: > Hi, > > I've got a WMS layer where I'm using an external SLD that I reference via the > 'SLD' parameter. Within the SLD I have both a PointSymbolizer and a > TextSymbolizer defined. If I use a property name as the value of the > TextSymbolizer's label nothing is displayed, modifying the SLD to use a > static string works fine. > > Strangely if I create a style in GeoServer using the same FeatureTypeStyle > definition and set that as the default style for the layer it renders > correctly in the Layer Preview. Can anybody explain why the label is not > displaying when using the external SLD? Using use provided SLD is tricky as it has various operation modes, people often haven't read the SLD appendix in detail and trip over "library mode" behavior. Can we see the full GetMap URL, as well as the full SLD? 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
