6

I've encountered a little problem with my styles having an assigned workspace. For one, I've got to admit that I'm not really sure what good does it make to put a certain style inside a workspace. I just guessed that if that style was going to be used by layers in a workspace, I might aswell add that workspace to the style.

So far, so good. But yesterday I ran into a problem trying to add my WMS service's URL to a map viewer web app. Let me put you in situation.

Let's say I have L1 layer, in W1 workspace with a default style of S1, which is also assigned to W1. Even if so far I didn't have any problems, this particular webapp didn't want to load the L1 layer attached to that same W1 workspace and S1 style. Whenever it did a GetMap request, GeoServer would return a "S1 style not found" error.

So, I had a look at the request itself and I noticed that, while in all other requests the "STYLES" parameter was missing (actually it was set to "(...)&STYLES=&(...)"), in this request it was "STYLES=S1". In fact, if I removed that from the request it worked correctly. This, I'm guessing is because S1 was set as L1 layer's default style.

Surprisingly, considering a L2 layer inside W1 with S1 as style too, it worked perfectly. After a bit of messing around I decided to remove S1's attachment to W1 workspace and, yay!, it worked and I was able to visualize L1 layer. So yes, the problem is solved. Now, my question is...

What is the real purpose of adding a workspace to a style? Is it worth it in any aspect? Should I not worry at all about this and just remove the workspace from all my styles?

Thanks for your help and sorry if it was a little confusing :-)

1
  • I noticed this problem too. In .../data/logs/geoserver.log I had the "org.geoserver.platform.ServiceException: No such style: S1" error. Removing the worksapce from the style fixed it. Thank you for the question.
    – Dave X
    Sep 18, 2015 at 19:43

3 Answers 3

4

You should use SLD styles without Workspaces. When you uploading SLDs to GeoServer do not associate them with workspaces. This is my recommendation. Beacuse i tested this problem (in GeoServer 2.4.2) as same as you. And they worked without error when I use general SLDs.

0
2

Whether you want/need to assign a style to workspace is up to you. For example, now I need to assign workspace to styles, because different workspaces belong to different groups of users and:

  1. they want some privacy
  2. there may be two different styles of the same name in two different workspaces.

So this is to your question. Regading how to display it, you need to use geoserver/myworkspace/ows?... URL syntax, just geoserver/ows would not work. As a consequence, don't assign styles from different workspaces, that cannot be shown.

0

Simply put your image file in data_dir/workspaces/YOURWORKSPACE/styles folder instead of data_dir/styles folder.

this is the link

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.