0

I have a GeoServer map request for which I want to use an alternate style...

https://xyz.com/geoserver/wms?LAYERS=earth:WAYS&CQL_FILTER=[(USAGE IN ('X'))]&STYLES=STYLE2&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&FORMAT=image%2Fpng&SRS=EPSG:4326&TRANSPARENT=TRUE&_OLSALT=0.89383&BBOX=0,0,45,45&WIDTH=256&HEIGHT=256

I get back a No such style: STYLE2

If I run the request at the GeoServer layer preview and change the style in the URL, I get back the proper result. It's just that it doesn't work when I try it through my network call. I can change the style in the network call URL to the built-in 'point' style and it works without problem. The only thing I can think of is that Geoserver is not looking in my workspace for the style, but rather the built-in, generic workspace where 'point' is stored. Perhaps there is a prefix I can place on the styles parameter, such as: ...&styles=earth:STYLE2... Tried that, but it didn't work. I think I also tried defining STYLE2 as a secondary style in the layer, but that didn't work either. The style is definitely created as I can see it in the GUI list of styles and it works in the layer preview.

Any ideas for the proper syntax or what I might be doing wrong?

  • 2
    What's the name of the style as presented to you in the GetCapabilities response for xyz.com/geoserver/wms – nmtoken Feb 16 at 4:27
2

If you have placed the style in the earth workspace then it should work using earth:style2. However you could also use the workspace specific endpoint (which is what the preview does) try changing the start of your URL to https://xyz/com/geoserver/earth/wms at which point you can leave off the prefixes for layers and styles.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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