[Geoserver-users] POST sld

Hi,

is it possible to POST sld to Geoserver?
I have a sld which is actually repeating itself according to the selected polygons in the view. There are two wms-layers (in OpenLayers), one with all polygons, and another one with selected ones with different style. I haven't come up with a better way to highlight polygons than constructing a dynamic sld. With GET it works to some extent, but after the number of selected polygons is bigger than 130, IE drops off and FF before the number is 500. I am only sending 5-digit attribute values, of which the sld is build by PHP. The number of selected polygons is that big, beacause they can be selected with different tools. User is not clicking 500 times!
I have tried to build a POST request which actaually is working, but I just can't figure out how could I get Geoserver to see the response of it.

- mika -

P.S. Does anyone no if there is a better way to do this in SLD 1.0 than this:

<Or><PropertyIsEqualTo><PropertyName>attr</PropertyName><Literal>12345</Literal></PropertyIsEqualTo>
<PropertyIsEqualTo><PropertyName>attr</PropertyName><Literal>23456</Literal></PropertyIsEqualTo> .....</Or>

Hi,

you say you use a GET request for the SLD file, how do you do that ?

It looks like I could use it to produce a dynamically tailored file to
solve my multiple graphic problem this way.

Thank you,

(Embedded image moved to file: pic23986.jpg)

CONFIDENTIALITE : Ce message et les éventuelles pièces attachées sont
confidentiels. Si vous n'êtes pas dans la liste des destinataires, veuillez
informer l'expéditeur immédiatement et ne pas divulguer le contenu à une
tierce personne, ne pas l'utiliser pour quelque raison que ce soit, ne pas
stocker ou copier l'information qu'il contient sur un quelconque support.

CONFIDENTIALITY : This e-mail and any attachments are confidential and may
be privileged. If you are not a named recipient, please notify the sender
immediately and do not disclose the contents to another person, use it for
any purpose or store or copy the information in any medium.

             "Lehtonen, Mika"
             <mika@anonymised.com
             net> A
                                       geoserver-users
             06/11/2008 00:52 <geoserver-users@anonymised.com
                                       net>
                                                                        cc
                                                                           
                                                                     Objet
                                       [Geoserver-users] POST sld
                                                                           
Hi,

is it possible to POST sld to Geoserver?
I have a sld which is actually repeating itself according to the
selected polygons in the view. There are two wms-layers (in OpenLayers),
one with all polygons, and another one with selected ones with different
style. I haven't come up with a better way to highlight polygons than
constructing a dynamic sld. With GET it works to some extent, but after
the number of selected polygons is bigger than 130, IE drops off and FF
before the number is 500. I am only sending 5-digit attribute values, of
which the sld is build by PHP. The number of selected polygons is that
big, beacause they can be selected with different tools. User is not
clicking 500 times!
I have tried to build a POST request which actaually is working, but I
just can't figure out how could I get Geoserver to see the response of it.

- mika -

P.S. Does anyone no if there is a better way to do this in SLD 1.0 than
this:

<Or><PropertyIsEqualTo><PropertyName>attr</PropertyName><Literal>12345</Literal></PropertyIsEqualTo>

<PropertyIsEqualTo><PropertyName>attr</PropertyName><Literal>23456</Literal></PropertyIsEqualTo>
.....</Or>

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's
challenge
Build the coolest Linux based applications with Moblin SDK & win great
prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

pic05786.jpg

Hi,

if you create your sld on client side, in OpenLayers you can merge it your wms-request as follows:
yourwmslayer.mergeNewParams({sld_body: yourDynamicSld});

If you were refering to wms-request in geoserver generally, here is something about it:
http://geoserver.org/display/GEOSDOC/Providing+SLD+to+GetMap+requests

Of course, if you are using "dynamic" sld, you have to construct it first. I've been using JavaScript on client side and PHP on server side.

- mika -

christian.dupont@anonymised.com kirjoitti:

Hi,

you say you use a GET request for the SLD file, how do you do that ?

It looks like I could use it to produce a dynamically tailored file to
solve my multiple graphic problem this way.

Thank you,

(Embedded image moved to file: pic23986.jpg)

CONFIDENTIALITE : Ce message et les éventuelles pièces attachées sont
confidentiels. Si vous n'êtes pas dans la liste des destinataires, veuillez
informer l'expéditeur immédiatement et ne pas divulguer le contenu à une
tierce personne, ne pas l'utiliser pour quelque raison que ce soit, ne pas
stocker ou copier l'information qu'il contient sur un quelconque support.

CONFIDENTIALITY : This e-mail and any attachments are confidential and may
be privileged. If you are not a named recipient, please notify the sender
immediately and do not disclose the contents to another person, use it for
any purpose or store or copy the information in any medium.

                                                                                        "Lehtonen, Mika" <mika@anonymised.com net> A geoserver-users 06/11/2008 00:52 <geoserver-users@anonymised.com net> cc
                                                                                                                                                Objet [Geoserver-users] POST sld
                                                                           
Hi,

is it possible to POST sld to Geoserver?
I have a sld which is actually repeating itself according to the
selected polygons in the view. There are two wms-layers (in OpenLayers),
one with all polygons, and another one with selected ones with different
style. I haven't come up with a better way to highlight polygons than
constructing a dynamic sld. With GET it works to some extent, but after
the number of selected polygons is bigger than 130, IE drops off and FF
before the number is 500. I am only sending 5-digit attribute values, of
which the sld is build by PHP. The number of selected polygons is that
big, beacause they can be selected with different tools. User is not
clicking 500 times!
I have tried to build a POST request which actaually is working, but I
just can't figure out how could I get Geoserver to see the response of it.

- mika -

P.S. Does anyone no if there is a better way to do this in SLD 1.0 than
this:

<Or><PropertyIsEqualTo><PropertyName>attr</PropertyName><Literal>12345</Literal></PropertyIsEqualTo>

<PropertyIsEqualTo><PropertyName>attr</PropertyName><Literal>23456</Literal></PropertyIsEqualTo>
.....</Or>

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's
challenge
Build the coolest Linux based applications with Moblin SDK & win great
prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

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

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

   Mika Lehtonen
   XML-Scanning Littoinen Ky
   Lankakatu 2 E 13, 20660 Littoinen
   mika@anonymised.com
   mbl +358 (0)44 2908259

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

Lehtonen, Mika ha scritto:

Hi,

is it possible to POST sld to Geoserver?
I have a sld which is actually repeating itself according to the selected polygons in the view. There are two wms-layers (in OpenLayers), one with all polygons, and another one with selected ones with different style. I haven't come up with a better way to highlight polygons than constructing a dynamic sld. With GET it works to some extent, but after the number of selected polygons is bigger than 130, IE drops off and FF before the number is 500. I am only sending 5-digit attribute values, of which the sld is build by PHP. The number of selected polygons is that big, beacause they can be selected with different tools. User is not clicking 500 times!
I have tried to build a POST request which actaually is working, but I just can't figure out how could I get Geoserver to see the response of it.

Yes, you can POST the SLD, but then you'll have troubles if you're
working within a browser because image tags do not accept their src
as POST. Anyways, here you can find some information:
http://geoserver.org/display/GEOSDOC/Providing+SLD+to+GetMap+requests
http://docs.codehaus.org/display/GEOSDOC/InlineFeature
http://geoserver.org/display/GEOSDOC/SLD+Snippets#SLDSnippets-MakeaPOSTrequesttoGeoServer%26nbsp%3B

Another way is to add &sld=url/to/sld/file in your GET request, and then either define the full map in that sld, or just define style names, and use styles=name1,name2,... to pick the styles out of that file (known as SLD library mode)

- mika -

P.S. Does anyone no if there is a better way to do this in SLD 1.0 than this:

<Or><PropertyIsEqualTo><PropertyName>attr</PropertyName><Literal>12345</Literal></PropertyIsEqualTo>
<PropertyIsEqualTo><PropertyName>attr</PropertyName><Literal>23456</Literal></PropertyIsEqualTo> .....</Or>

I know of no better way, sorry.
Cheers
Andrea

--
Andrea Aime
OpenGeo - http://opengeo.org
Expert service straight from the developers.

Thanks,
I came up with one solution, but unfortunately it doesn't seem to be working. I think the cause is not Geoserver related, but better check and double check. I am parsing a bunch of parameters into array and then posting them as a string to "php-sld-maker". I then add that php-file as an sld into my wms-request in OpenLayers. Just wondering whether Geoserver grabs an empty template or the one just made. Anyway, I get SAXParseException: Content is not allowed in trailing section. Or: Premature end of file. If I grab that sld from the POST-response (with Firebug) and upload it into server as a static sld, it seem to be working just fine. Those exceptions usually refer to fact that there's something wrong with that XML, afaik.
Here is the stack trace:
- mika -

2008-11-06 13:15:15,025 DEBUG [org.geoserver.ows] - Getting layers and styles from reomte SLD
2008-11-06 13:15:15,026 ERROR [org.geoserver.ows] -
java.lang.RuntimeException: org.xml.sax.SAXParseException: Premature end of file.
    at org.geotools.styling.SLDParser.parseSLD(SLDParser.java:364)
    at org.geoserver.wms.kvp.GetMapKvpRequestReader.parseSld(GetMapKvpRequestReader.java:413)
    at org.geoserver.wms.kvp.GetMapKvpRequestReader.read(GetMapKvpRequestReader.java:245)
    at org.geoserver.ows.Dispatcher.parseRequestKVP(Dispatcher.java:1001)
    at org.geoserver.ows.Dispatcher.dispatch(Dispatcher.java:387)
    at org.geoserver.ows.Dispatcher.handleRequestInternal(Dispatcher.java:195)
    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:690)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.vfny.geoserver.filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:108)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:264)
    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:274)
    at org.acegisecurity.ui.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:110)
    at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
    at org.acegisecurity.providers.anonymous.AnonymousProcessingFilter.doFilter(AnonymousProcessingFilter.java:125)
    at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
    at org.acegisecurity.ui.basicauth.BasicProcessingFilter.doFilter(BasicProcessingFilter.java:178)
    at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
    at org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:229)
    at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
    at org.acegisecurity.util.FilterChainProxy.doFilter(FilterChainProxy.java:148)
    at org.acegisecurity.util.FilterToBeanProxy.doFilter(FilterToBeanProxy.java:98)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.geoserver.filters.LoggingFilter.doFilter(LoggingFilter.java:73)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.geoserver.filters.ReverseProxyFilter.doFilter(ReverseProxyFilter.java:163)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.geoserver.filters.GZIPFilter.doFilter(GZIPFilter.java:41)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.authenticator.SingleSignOn.invoke(SingleSignOn.java:394)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
    at java.lang.Thread.run(Thread.java:619)
Caused by: org.xml.sax.SAXParseException: Premature end of file.
    at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
    at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
    at org.geotools.styling.SLDParser.parseSLD(SLDParser.java:352)
    ... 54 more

And another one:

2008-11-06 13:11:24,356 DEBUG [org.geoserver.ows] - Getting layers and styles from reomte SLD
2008-11-06 13:11:24,357 ERROR [org.geoserver.ows] -
java.lang.RuntimeException: org.xml.sax.SAXParseException: Content is not allowed in trailing section.
    at org.geotools.styling.SLDParser.parseSLD(SLDParser.java:364)
    at org.geoserver.wms.kvp.GetMapKvpRequestReader.parseSld(GetMapKvpRequestReader.java:413)
    at org.geoserver.wms.kvp.GetMapKvpRequestReader.read(GetMapKvpRequestReader.java:245)
    at org.geoserver.ows.Dispatcher.parseRequestKVP(Dispatcher.java:1001)
    at org.geoserver.ows.Dispatcher.dispatch(Dispatcher.java:387)
    at org.geoserver.ows.Dispatcher.handleRequestInternal(Dispatcher.java:195)
    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:690)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.vfny.geoserver.filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:108)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:264)
    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:274)
    at org.acegisecurity.ui.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:110)
    at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
    at org.acegisecurity.providers.anonymous.AnonymousProcessingFilter.doFilter(AnonymousProcessingFilter.java:125)
    at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
    at org.acegisecurity.ui.basicauth.BasicProcessingFilter.doFilter(BasicProcessingFilter.java:178)
    at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
    at org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:229)
    at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
    at org.acegisecurity.util.FilterChainProxy.doFilter(FilterChainProxy.java:148)
    at org.acegisecurity.util.FilterToBeanProxy.doFilter(FilterToBeanProxy.java:98)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.geoserver.filters.LoggingFilter.doFilter(LoggingFilter.java:73)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.geoserver.filters.ReverseProxyFilter.doFilter(ReverseProxyFilter.java:163)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.geoserver.filters.GZIPFilter.doFilter(GZIPFilter.java:41)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.authenticator.SingleSignOn.invoke(SingleSignOn.java:394)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
    at java.lang.Thread.run(Thread.java:619)
Caused by: org.xml.sax.SAXParseException: Content is not allowed in trailing section.
    at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
    at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
    at org.geotools.styling.SLDParser.parseSLD(SLDParser.java:352)
    ... 54 more

Andrea Aime kirjoitti:

Lehtonen, Mika ha scritto:

Hi,

is it possible to POST sld to Geoserver?
I have a sld which is actually repeating itself according to the selected polygons in the view. There are two wms-layers (in OpenLayers), one with all polygons, and another one with selected ones with different style. I haven't come up with a better way to highlight polygons than constructing a dynamic sld. With GET it works to some extent, but after the number of selected polygons is bigger than 130, IE drops off and FF before the number is 500. I am only sending 5-digit attribute values, of which the sld is build by PHP. The number of selected polygons is that big, beacause they can be selected with different tools. User is not clicking 500 times!
I have tried to build a POST request which actaually is working, but I just can't figure out how could I get Geoserver to see the response of it.

Yes, you can POST the SLD, but then you'll have troubles if you're
working within a browser because image tags do not accept their src
as POST. Anyways, here you can find some information:
http://geoserver.org/display/GEOSDOC/Providing+SLD+to+GetMap+requests
http://docs.codehaus.org/display/GEOSDOC/InlineFeature
http://geoserver.org/display/GEOSDOC/SLD+Snippets#SLDSnippets-MakeaPOSTrequesttoGeoServer%26nbsp%3B

Another way is to add &sld=url/to/sld/file in your GET request, and then either define the full map in that sld, or just define style names, and use styles=name1,name2,... to pick the styles out of that file (known as SLD library mode)

- mika -

P.S. Does anyone no if there is a better way to do this in SLD 1.0 than this:

<Or><PropertyIsEqualTo><PropertyName>attr</PropertyName><Literal>12345</Literal></PropertyIsEqualTo>

<PropertyIsEqualTo><PropertyName>attr</PropertyName><Literal>23456</Literal></PropertyIsEqualTo> .....</Or>

I know of no better way, sorry.
Cheers
Andrea

Hi,

I got his working. It was a matter of session management. If anyone wants to know one way to use dynamic styles in Openlayers/Geoserver, I can hand in my five cents and share my way to do it.

My way is the following:
I have a application where user can select regions (wms-layer) with different tools. So there can be like 200 out of 2000 selected regions. In order to visualize this, a clone of wms-layer is created. An array of attributes (selected ones) + session_id is sent by POST into php-file which creates a new sld. After that the new sld definition (http://wherethephpis/sld.php?session=session_id is merged into wms-request. That way you don't have to care about the GET restrictions (1024 characters in IE?).

- mika -

Lehtonen, Mika kirjoitti:

Thanks,
I came up with one solution, but unfortunately it doesn't seem to be working. I think the cause is not Geoserver related, but better check and double check. I am parsing a bunch of parameters into array and then posting them as a string to "php-sld-maker". I then add that php-file as an sld into my wms-request in OpenLayers. Just wondering whether Geoserver grabs an empty template or the one just made. Anyway, I get SAXParseException: Content is not allowed in trailing section. Or: Premature end of file. If I grab that sld from the POST-response (with Firebug) and upload it into server as a static sld, it seem to be working just fine. Those exceptions usually refer to fact that there's something wrong with that XML, afaik.
Here is the stack trace:
- mika -

2008-11-06 13:15:15,025 DEBUG [org.geoserver.ows] - Getting layers and styles from reomte SLD
2008-11-06 13:15:15,026 ERROR [org.geoserver.ows] -
java.lang.RuntimeException: org.xml.sax.SAXParseException: Premature end of file.
    at org.geotools.styling.SLDParser.parseSLD(SLDParser.java:364)
    at org.geoserver.wms.kvp.GetMapKvpRequestReader.parseSld(GetMapKvpRequestReader.java:413)
    at org.geoserver.wms.kvp.GetMapKvpRequestReader.read(GetMapKvpRequestReader.java:245)
    at org.geoserver.ows.Dispatcher.parseRequestKVP(Dispatcher.java:1001)
    at org.geoserver.ows.Dispatcher.dispatch(Dispatcher.java:387)
    at org.geoserver.ows.Dispatcher.handleRequestInternal(Dispatcher.java:195)
    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:690)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.vfny.geoserver.filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:108)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:264)
    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:274)
    at org.acegisecurity.ui.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:110)
    at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
    at org.acegisecurity.providers.anonymous.AnonymousProcessingFilter.doFilter(AnonymousProcessingFilter.java:125)
    at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
    at org.acegisecurity.ui.basicauth.BasicProcessingFilter.doFilter(BasicProcessingFilter.java:178)
    at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
    at org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:229)
    at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
    at org.acegisecurity.util.FilterChainProxy.doFilter(FilterChainProxy.java:148)
    at org.acegisecurity.util.FilterToBeanProxy.doFilter(FilterToBeanProxy.java:98)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.geoserver.filters.LoggingFilter.doFilter(LoggingFilter.java:73)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.geoserver.filters.ReverseProxyFilter.doFilter(ReverseProxyFilter.java:163)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.geoserver.filters.GZIPFilter.doFilter(GZIPFilter.java:41)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.authenticator.SingleSignOn.invoke(SingleSignOn.java:394)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
    at java.lang.Thread.run(Thread.java:619)
Caused by: org.xml.sax.SAXParseException: Premature end of file.
    at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
    at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
    at org.geotools.styling.SLDParser.parseSLD(SLDParser.java:352)
    ... 54 more

And another one:

2008-11-06 13:11:24,356 DEBUG [org.geoserver.ows] - Getting layers and styles from reomte SLD
2008-11-06 13:11:24,357 ERROR [org.geoserver.ows] -
java.lang.RuntimeException: org.xml.sax.SAXParseException: Content is not allowed in trailing section.
    at org.geotools.styling.SLDParser.parseSLD(SLDParser.java:364)
    at org.geoserver.wms.kvp.GetMapKvpRequestReader.parseSld(GetMapKvpRequestReader.java:413)
    at org.geoserver.wms.kvp.GetMapKvpRequestReader.read(GetMapKvpRequestReader.java:245)
    at org.geoserver.ows.Dispatcher.parseRequestKVP(Dispatcher.java:1001)
    at org.geoserver.ows.Dispatcher.dispatch(Dispatcher.java:387)
    at org.geoserver.ows.Dispatcher.handleRequestInternal(Dispatcher.java:195)
    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:690)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.vfny.geoserver.filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:108)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:264)
    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:274)
    at org.acegisecurity.ui.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:110)
    at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
    at org.acegisecurity.providers.anonymous.AnonymousProcessingFilter.doFilter(AnonymousProcessingFilter.java:125)
    at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
    at org.acegisecurity.ui.basicauth.BasicProcessingFilter.doFilter(BasicProcessingFilter.java:178)
    at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
    at org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:229)
    at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
    at org.acegisecurity.util.FilterChainProxy.doFilter(FilterChainProxy.java:148)
    at org.acegisecurity.util.FilterToBeanProxy.doFilter(FilterToBeanProxy.java:98)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.geoserver.filters.LoggingFilter.doFilter(LoggingFilter.java:73)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.geoserver.filters.ReverseProxyFilter.doFilter(ReverseProxyFilter.java:163)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.geoserver.filters.GZIPFilter.doFilter(GZIPFilter.java:41)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.authenticator.SingleSignOn.invoke(SingleSignOn.java:394)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
    at java.lang.Thread.run(Thread.java:619)
Caused by: org.xml.sax.SAXParseException: Content is not allowed in trailing section.
    at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
    at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
    at org.geotools.styling.SLDParser.parseSLD(SLDParser.java:352)
    ... 54 more

Andrea Aime kirjoitti:
  

Lehtonen, Mika ha scritto:
    

Hi,

is it possible to POST sld to Geoserver?
I have a sld which is actually repeating itself according to the selected polygons in the view. There are two wms-layers (in OpenLayers), one with all polygons, and another one with selected ones with different style. I haven't come up with a better way to highlight polygons than constructing a dynamic sld. With GET it works to some extent, but after the number of selected polygons is bigger than 130, IE drops off and FF before the number is 500. I am only sending 5-digit attribute values, of which the sld is build by PHP. The number of selected polygons is that big, beacause they can be selected with different tools. User is not clicking 500 times!
I have tried to build a POST request which actaually is working, but I just can't figure out how could I get Geoserver to see the response of it.
      

Yes, you can POST the SLD, but then you'll have troubles if you're
working within a browser because image tags do not accept their src
as POST. Anyways, here you can find some information:
http://geoserver.org/display/GEOSDOC/Providing+SLD+to+GetMap+requests
http://docs.codehaus.org/display/GEOSDOC/InlineFeature
http://geoserver.org/display/GEOSDOC/SLD+Snippets#SLDSnippets-MakeaPOSTrequesttoGeoServer%26nbsp%3B

Another way is to add &sld=url/to/sld/file in your GET request, and then either define the full map in that sld, or just define style names, and use styles=name1,name2,... to pick the styles out of that file (known as SLD library mode)

- mika -

P.S. Does anyone no if there is a better way to do this in SLD 1.0 than this:

<Or><PropertyIsEqualTo><PropertyName>attr</PropertyName><Literal>12345</Literal></PropertyIsEqualTo>

<PropertyIsEqualTo><PropertyName>attr</PropertyName><Literal>23456</Literal></PropertyIsEqualTo> .....</Or>
      

I know of no better way, sorry.
Cheers
Andrea

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users