Thanks again Joshua for guiding me through this.
“If you’re going to be requesting layer images with dynamic styling
then you can’t use the cached version of the layer; the cached version
is pre-rendered with whatever styles were set on the layer in
geoserver and/or gwc.”
I was afraid of this…that’s just too bad :(. I want to cache my layers and be able to switch the SLD with OpenLayers (I’m truly heartbroken here)
“GWC can be set up to cache multiple versions
of a layer based on the values in the STYLES= (or any other) wms
parameter, but that won’t work if you are using truly dynamic styles;
for example if you let the user choose arbitrarily style parameters on
the client side and build an SLD from that.”
How come? What I mean to ask is that even if the user does pick the SLD and it is built on the fly, wouldn’t that SLD still have to be set-up in the same format as that read from the file?
"If your SLD really is dynamic you’re going to have to use the
non-cached version of the layer. If your GWC and Geoserver layers map
1:1 with each other (which is true for a standard install without a
geowebcache.xml file) then just removing “gwc/service/” from the layer
URL will get you the non-cached version. For example:
gwc url: http://localhost:8080/geoserver/gwc/service/wms
non-cached url: http://localhost:8080/geoserver/wms"
Yes, I was first trying this with my non-cached layers. When you first helped me with this :), but I had forgotten about my cached layers and as I was working, realized that it’s probably not going to be a possibility
Thanks so much for all your help!
Happy Mapping,
elshae
On Fri, Jan 21, 2011 at 3:47 PM, Joshua M. Thompson <joshua.thompson@anonymised.com> wrote:
On Fri, Jan 21, 2011 at 12:12 PM, IT Intern <itintern12@anonymised.com> wrote:
I just recently resolved the issue of changing my layers style through
OpenLayers using:
myLayer.mergeNewParams({sld
:‘file:///usr/local/geoserver-2.0.2/data_dir/styles/myLayerSLD.sld’, styles:
null});
and that works great if I am using WMS layers which are not cached by
GeoWebCache.
But if my layers are cached, using the above does not work. I have also
tried using
myLayer.redraw(true);
Which is an OpenLayers library method that I believe is called automatically
with the call to mergeNewParams, so I knew it wouldn’t work.
So now I am assuming that I have to set-up something in my GeoWebCache to
accept dynamic SLD. Any ideas or hints?
If you’re going to be requesting layer images with dynamic styling
then you can’t use the cached version of the layer; the cached version
is pre-rendered with whatever styles were set on the layer in
geoserver and/or gwc. GWC can be set up to cache multiple versions
of a layer based on the values in the STYLES= (or any other) wms
parameter, but that won’t work if you are using truly dynamic styles;
for example if you let the user choose arbitrarily style parameters on
the client side and build an SLD from that.
If your SLD really is dynamic you’re going to have to use the
non-cached version of the layer. If your GWC and Geoserver layers map
1:1 with each other (which is true for a standard install without a
geowebcache.xml file) then just removing “gwc/service/” from the layer
URL will get you the non-cached version. For example:
gwc url: http://localhost:8080/geoserver/gwc/service/wms
non-cached url: http://localhost:8080/geoserver/wms