Hi Guys,
I tried for hours to use NamedStyle unsuccessfully.
Here is what I do :
1 / I have a first SLD file (let's name it FRC8) containing a UserStyle
2/ I have a second SLD file (let's name it FRC7) containing also a UserStyle
3/ I have a third SLD file (let's name it NW) containing two NamedStyle
I wanted to know if it's possible in GeoServer to associate a layer to the
style NW and if this style can 'refer' via NamedStyle the first two defined
styles.
The reason for putting it all together is that in the real usage it's not just
two files but a lot more and I wanted to reuse them in other SLD, this way one
change could affect them all, plus the fact that those files have been created
just for the example, others are much longer.
FRC7.SLD
<?xml version="1.0" encoding="UTF-8"?>
<StyledLayerDescriptor version="1.0.0"
xsi:schemaLocation="http://www.opengis.net/sld
StyledLayerDescriptor.xsd"
xmlns="http://www.opengis.net/sld"
xmlns:ogc="http://www.opengis.net/ogc"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<NamedLayer>
<Name>FRC7_NL</Name>
<UserStyle>
<Name>FRC7_STL</Name>
<FeatureTypeStyle>
<Rule>
<Name>FRC 7 / Background / Max 34000</Name>
<ogc:Filter>
<ogc:And>
<ogc:PropertyIsEqualTo>
<ogc:Literal>True</ogc:Literal>
<ogc:Function name="env">
<ogc:Literal>FRC7_Display</ogc:Literal>
<ogc:Literal>True</ogc:Literal>
</ogc:Function>
</ogc:PropertyIsEqualTo>
<ogc:PropertyIsEqualTo>
<ogc:PropertyName>frc</ogc:PropertyName>
<ogc:Literal>7</ogc:Literal>
</ogc:PropertyIsEqualTo>
</ogc:And>
</ogc:Filter>
<MaxScaleDenominator>34000</MaxScaleDenominator>
<LineSymbolizer>
<Stroke>
<CssParameter name="stroke">
<ogc:Function name="env">
<ogc:Literal>FRC7_Bkgd_34K_Stroke</ogc:Literal>
<ogc:Literal>#FF0000</ogc:Literal>
</ogc:Function>
</CssParameter>
<CssParameter name="stroke-width">
<ogc:Function name="env">
<ogc:Literal>FRC7_Bkgd_34K_StrokeWidth</ogc:Literal>
<ogc:Literal>6</ogc:Literal>
</ogc:Function>
</CssParameter>
</Stroke>
</LineSymbolizer>
</Rule>
</FeatureTypeStyle>
</UserStyle>
</NamedLayer>
</StyledLayerDescriptor>
FRC8.SLD
<?xml version="1.0" encoding="UTF-8"?>
<StyledLayerDescriptor version="1.0.0"
xsi:schemaLocation="http://www.opengis.net/sld
StyledLayerDescriptor.xsd"
xmlns="http://www.opengis.net/sld"
xmlns:ogc="http://www.opengis.net/ogc"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<NamedLayer>
<Name>FRC8_NL</Name>
<UserStyle>
<Name>FRC8_STL</Name>
<FeatureTypeStyle>
<Rule>
<Name>FRC 8 / Background / Max 34000</Name>
<ogc:Filter>
<ogc:And>
<ogc:PropertyIsEqualTo>
<ogc:Literal>True</ogc:Literal>
<ogc:Function name="env">
<ogc:Literal>FRC8_Display</ogc:Literal>
<ogc:Literal>True</ogc:Literal>
</ogc:Function>
</ogc:PropertyIsEqualTo>
<ogc:PropertyIsEqualTo>
<ogc:PropertyName>frc</ogc:PropertyName>
<ogc:Literal>8</ogc:Literal>
</ogc:PropertyIsEqualTo>
</ogc:And>
</ogc:Filter>
<MaxScaleDenominator>34000</MaxScaleDenominator>
<LineSymbolizer>
<Stroke>
<CssParameter name="stroke">
<ogc:Function name="env">
<ogc:Literal>FRC8_Bkgd_34K_Stroke</ogc:Literal>
<ogc:Literal>#CCCCCC</ogc:Literal>
</ogc:Function>
</CssParameter>
<CssParameter name="stroke-width">
<ogc:Function name="env">
<ogc:Literal>FRC8_Bkgd_34K_StrokeWidth</ogc:Literal>
<ogc:Literal>6</ogc:Literal>
</ogc:Function>
</CssParameter>
</Stroke>
</LineSymbolizer>
</Rule>
</FeatureTypeStyle>
</UserStyle>
</NamedLayer>
</StyledLayerDescriptor>
NW.SLD
<?xml version="1.0" encoding="UTF-8"?>
<StyledLayerDescriptor version="1.0.0"
xsi:schemaLocation="http://www.opengis.net/sld
StyledLayerDescriptor.xsd"
xmlns="http://www.opengis.net/sld"
xmlns:ogc="http://www.opengis.net/ogc"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<NamedLayer>
<Name>NW</Name>
<NamedStyle>
<Name>FRC8_STL</Name>
</NamedStyle>
<NamedStyle>
<Name> FRC7_STL </Name>
</NamedStyle>
</NamedLayer>
</StyledLayerDescriptor>
In this file I tried changing the name value FRC8_STL by FRC8_NL,
FRC8_NL:FRC8_STL, and even the path to the sld file (same for FRC7)
The only thing I got when requesting the layer is the following error :
<?xml version="1.0" encoding="UTF-8" standalone="no"?><!DOCTYPE
ServiceExceptionReport SYSTEM
"http://localhost:8080/geoserver/schemas/wms/1.1.1/WMS_exception_1_1_1.dtd">
<ServiceExceptionReport version="1.1.1" > <ServiceException>
java.lang.ArrayIndexOutOfBoundsException: 0
0
Details:
org.geoserver.platform.ServiceException:
java.lang.ArrayIndexOutOfBoundsException: 0
at org.geoserver.ows.Dispatcher.exception(Dispatcher.java:1304)
at
org.geoserver.ows.Dispatcher.handleRequestInternal(Dispatcher.java:240)
at
org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:153)
at
org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48)
at
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:875)
at
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:809)
at
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:571)
at
org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:501)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at
org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
at
org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1093)
at
org.vfny.geoserver.filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:108)
at
org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)
at
org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:265)
at
org.acegisecurity.intercept.web.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:107)
at
org.acegisecurity.intercept.web.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:72)
at
org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
at
org.acegisecurity.ui.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:124)
at
org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
at
org.acegisecurity.providers.anonymous.AnonymousProcessingFilter.doFilter(AnonymousProcessingFilter.java:125)
at
org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
at
org.acegisecurity.ui.basicauth.BasicProcessingFilter.doFilter(BasicProcessingFilter.java:174)
at
org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
at
org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:249)
at
org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
at
org.acegisecurity.util.FilterChainProxy.doFilter(FilterChainProxy.java:149)
at
org.acegisecurity.util.FilterToBeanProxy.doFilter(FilterToBeanProxy.java:98)
at
org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)
at
org.geoserver.filters.LoggingFilter.doFilter(LoggingFilter.java:73)
at
org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)
at
org.geoserver.filters.ReverseProxyFilter.doFilter(ReverseProxyFilter.java:183)
at
org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)
at org.geoserver.filters.GZIPFilter.doFilter(GZIPFilter.java:41)
at
org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)
at
org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:360)
at
org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
at
org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
at
org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:726)
at
org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
at
org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:206)
at
org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
at
org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
at org.mortbay.jetty.Server.handle(Server.java:324)
at
org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505)
at
org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:828)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:514)
at
org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
at
org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)
at
org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395)
at
org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:450)
Caused by: java.lang.ArrayIndexOutOfBoundsException: 0
at
org.geoserver.catalog.ResourcePool.getStyle(ResourcePool.java:1032)
at
org.geoserver.catalog.impl.StyleInfoImpl.getStyle(StyleInfoImpl.java:60)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org.geoserver.catalog.impl.ModificationProxy.invoke(ModificationProxy.java:118)
at $Proxy9.getStyle(Unknown Source)
at
org.geoserver.wms.kvp.GetMapKvpRequestReader.read(GetMapKvpRequestReader.java:313)
at
org.geoserver.wms.kvp.GetMapKvpRequestReader.read(GetMapKvpRequestReader.java:71)
at
org.geoserver.ows.Dispatcher.parseRequestKVP(Dispatcher.java:1120)
at org.geoserver.ows.Dispatcher.dispatch(Dispatcher.java:457)
at
org.geoserver.ows.Dispatcher.handleRequestInternal(Dispatcher.java:227)
... 49 more
</ServiceException></ServiceExceptionReport>
Any help welcomed.
Cheers,
--
Jérémy Hanoun
------------------------------------------------------------------------------
The Next 800 Companies to Lead America's Growth: New Video Whitepaper
David G. Thomson, author of the best-selling book "Blueprint to a
Billion" shares his insights and actions to help propel your
business during the next growth cycle. Listen Now!
http://p.sf.net/sfu/SAP-dev2dev
_______________________________________________
Geoserver-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-users