Problem SLD_BODY --> too many characters

8 messages Options
Embed this post
Permalink
stash

Problem SLD_BODY --> too many characters

Reply Threaded More More options
Print post
Permalink
Hello,
I have a Openlayers.layer.wms to show a map. Furthermore I have a sld_body to show not all features on the map.

My big problem is, that my sld_body is very large (because of some filters i've added and various styles). I store my sld_body in a variable in javascript and add this variable with merge.newparams to my layer. And there is the problem.

Thereby my sld_body contains so much characters, the variable doesn't contain the whole sld_body --> I get no features on my map. When I make my sld_body a bit shorter, everything is working. Then I try to add the sld_body direclty to the layer without mergenewparams later. The same problem.

I'm sure that the variable can't store so much characters because I watched my javascript file in firebug and there, the variable didn't contain the whole sld_body.

My question is now, if there is any possibility, that i can add my whole sld_body to my javascript. Are there variables, which can contain more characters in java script.

(Maybe another solution would be to add 2 sld_bodys to my layer. Is this possible?)

Please help me.

Regards
stash
Roald de Wit-2

Re: SLD_BODY too many characters

Reply Threaded More More options
Print post
Permalink
Hi stash,

If you dare to 'live on the edge', use the development version of OL,
which has the following great addition: a WMS Post Layer [2]

That should solve your problem!

[1] http://dev.openlayers.org/nightly/OpenLayers.js
[2] http://dev.openlayers.org/docs/files/OpenLayers/Layer/WMS/Post-js.html

Regards, Roald

stash wrote:

> Hello,
> I have a Openlayers.layer.wms to show a map. Furthermore I have a sld_body
> to show not all features on the map.
>
> My big problem is, that my sld_body is very large (because of some filters
> i've added and various styles). I store my sld_body in a variable in
> javascript and add this variable with merge.newparams to my layer. And there
> is the problem.
>
> Thereby my sld_body contains so much characters, the variable doesn't
> contain the whole sld_body --> I get no features on my map. When I make my
> sld_body a bit shorter, everything is working. Then I try to add the
> sld_body direclty to the layer without mergenewparams later. The same
> problem.
>
> I'm sure that the variable can't store so much characters because I watched
> my javascript file in firebug and there, the variable didn't contain the
> whole sld_body.
>
> My question is now, if there is any possibility, that i can add my whole
> sld_body to my javascript. Are there variables, which can contain more
> characters in java script.
>
> (Maybe another solution would be to add 2 sld_bodys to my layer. Is this
> possible?)
>
> Please help me.
>
> Regards
> stash
>  

_______________________________________________
Users mailing list
[hidden email]
http://openlayers.org/mailman/listinfo/users
bartvde

Re: SLD_BODY too many characters

Reply Threaded More More options
Print post
Permalink
In reply to this post by stash
Hi,

you are running into the limitation of the url length in the browser.

Which WMS are you using? Maybe you can try Layer.WMS.POST (in trunk) if
your WMS supports POST?

Alternatively, post your string to a custom script on the server, and give
back a url which you can use in the GetMap request using the SLD parameter
instead.

Best regards,
Bart

>
> Hello,
> I have a Openlayers.layer.wms to show a map. Furthermore I have a sld_body
> to show not all features on the map.
>
> My big problem is, that my sld_body is very large (because of some filters
> i've added and various styles). I store my sld_body in a variable in
> javascript and add this variable with merge.newparams to my layer. And
> there
> is the problem.
>
> Thereby my sld_body contains so much characters, the variable doesn't
> contain the whole sld_body --> I get no features on my map. When I make my
> sld_body a bit shorter, everything is working. Then I try to add the
> sld_body direclty to the layer without mergenewparams later. The same
> problem.
>
> I'm sure that the variable can't store so much characters because I
> watched
> my javascript file in firebug and there, the variable didn't contain the
> whole sld_body.
>
> My question is now, if there is any possibility, that i can add my whole
> sld_body to my javascript. Are there variables, which can contain more
> characters in java script.
>
> (Maybe another solution would be to add 2 sld_bodys to my layer. Is this
> possible?)
>
> Please help me.
>
> Regards
> stash
> --
> View this message in context:
> http://n2.nabble.com/SLD-BODY-too-many-characters-tp3950862p3950862.html
> Sent from the OpenLayers Users mailing list archive at Nabble.com.
> _______________________________________________
> Users mailing list
> [hidden email]
> http://openlayers.org/mailman/listinfo/users
>


_______________________________________________
Users mailing list
[hidden email]
http://openlayers.org/mailman/listinfo/users
stash

Re: SLD_BODY too many characters

Reply Threaded More More options
Print post
Permalink
In reply to this post by Roald de Wit-2

Roald de Wit-2 wrote:
Hi stash,

If you dare to 'live on the edge', use the development version of OL,
which has the following great addition: a WMS Post Layer [2]

That should solve your problem!

[1] http://dev.openlayers.org/nightly/OpenLayers.js
[2] http://dev.openlayers.org/docs/files/OpenLayers/Layer/WMS/Post-js.html

Regards, Roald
Hi,
thanks for your answer. I imported the new nightly version of openlayers and changed my wms in a wms.post. However, i get the same result.

Apparently, my slb_body is to large (because everything works when i made my sld_body a bit shorter.)

Do I have to change more (for example params or something else) when i use a wms.post? Because the only thing I changed when i declare my openlayers.layer.wms is that I changed it into wms.post.

Regards
stash
Roald de Wit-2

Re: SLD_BODY too many characters

Reply Threaded More More options
Print post
Permalink
Hi,

stash wrote:

> Hi,
> thanks for your answer. I imported the new nightly version of openlayers and
> changed my wms in a wms.post. However, i get the same result.
>
> Apparently, my slb_body is to large (because everything works when i made my
> sld_body a bit shorter.)
>
> Do I have to change more (for example params or something else) when i use a
> wms.post? Because the only thing I changed when i declare my
> openlayers.layer.wms is that I changed it into wms.post.
>  

Have a look at the following example:
http://www.openlayers.org/dev/examples/WMSPost.html

I hope that helps. If not, you can always consider Bart's alternative
solution.

Regards,

Roald

_______________________________________________
Users mailing list
[hidden email]
http://openlayers.org/mailman/listinfo/users
Andreas Hocevar-2

Re: SLD_BODY too many characters

Reply Threaded More More options
Print post
Permalink
In reply to this post by stash
Hi,

a few questions:

Which browser were you trying? The only browser that requires
Layer.WMS.Post is Internet Explorer. Other browsers can handle long URLs
in Get requests fine. Layer.WMS.Post uses Get by default in Opera and
Firefox, unless you configure it with the usupportedBrowsers option set
to []:

var layer = new OpenLayers.Layer.WMS.Post("name", "url", {
    sld_body: "your sld body here"
}, {
    unsupportedBrowsers: []
});

If it works after that change, then your server cannot handle long URLs.
If it still does not work, then something is wrong with your SLD. Did
you try if it validates? Or if it works when using SLD with a url
reference instead of SLD_BODY?

Regards,
Andreas.

stash wrote:

>
> Roald de Wit-2 wrote:
>  
>> Hi stash,
>>
>> If you dare to 'live on the edge', use the development version of OL,
>> which has the following great addition: a WMS Post Layer [2]
>>
>> That should solve your problem!
>>
>> [1] http://dev.openlayers.org/nightly/OpenLayers.js
>> [2] http://dev.openlayers.org/docs/files/OpenLayers/Layer/WMS/Post-js.html
>>
>> Regards, Roald
>>
>>
>>    
>
> Hi,
> thanks for your answer. I imported the new nightly version of openlayers and
> changed my wms in a wms.post. However, i get the same result.
>
> Apparently, my slb_body is to large (because everything works when i made my
> sld_body a bit shorter.)
>
> Do I have to change more (for example params or something else) when i use a
> wms.post? Because the only thing I changed when i declare my
> openlayers.layer.wms is that I changed it into wms.post.
>
> Regards
> stash
>
>  


--
Andreas Hocevar
OpenGeo - http://opengeo.org/
Expert service straight from the developers.

_______________________________________________
Users mailing list
[hidden email]
http://openlayers.org/mailman/listinfo/users
stash

Re: SLD_BODY too many characters

Reply Threaded More More options
Print post
Permalink
Hi,
thanks for the very helpful answers. Now it's working. I'm using Firefox but when the wms.post is needed in internet explorer I will leave it in my code.

Infact the line unsupportedBrowsers: [] is extremely important, otherwise it doesn't work. Can someone tell me, what this line means?

Thanks for your answers. Now I'm happy :)

Regards
stash
Andreas Hocevar-2

Re: SLD_BODY too many characters

Reply Threaded More More options
Print post
Permalink
Hi,

stash wrote:
> thanks for the very helpful answers. Now it's working. I'm using Firefox but
> when the wms.post is needed in internet explorer I will leave it in my code.
>
> Infact the line unsupportedBrowsers: [] is extremely important, otherwise it
> doesn't work. Can someone tell me, what this line means?
>  

See
http://dev.openlayers.org/docs/files/OpenLayers/Layer/WMS/Post-js.html#OpenLayers.Layer.WMS.Post.unsupportedBrowsers 
for an explanation. Basically Layer.WMS.Post can fall back to a Get
request for browsers that do not support the iFrame-based approach to
use Post requests well.

If your requests only work when unsupportedBrowsers is set to an empty
array ([]), this means that your server does not support long URLs in
Get requests.

Regards,
Andreas.

> Thanks for your answers. Now I'm happy :)
>
> Regards
> stash
>
>  


--
Andreas Hocevar
OpenGeo - http://opengeo.org/
Expert service straight from the developers.

_______________________________________________
Users mailing list
[hidden email]
http://openlayers.org/mailman/listinfo/users