I add WMS connection to openLayers, it has 127 different layers. I add one Layer which occurred to be small icons symbolizing Pictures on map. But the styling is ugly, according to the specification of layers (GetCapabilities) "Styles" is set to "Default". I want to style each icon on this WMS layer, but i cant understand how.

My sample code below:

new TileLayer({
    id             : 5,
    name           : 'test picture_1',
    visible : false,
    source  : new TileWMS({
        url     : WMSUrl,
        params  : {
            'TILED'     : true,
            'LAYERS'    : 118
        transparent: 'true',
        projection : "EPSG:3057"

How could i style all features (which are small icons on the map) in this layer ?

1 Answer 1


You can't, a WMS returns a picture of the map that has been rendered by the WMS server. If you want to style a layer in the client you have two choices:

  1. request the actual data from a WFS server and style it yourself.
  2. Send a SLD file to the WMS server for it to use to style the data. You can check for this option by looking for a line like: <UserDefinedSymbolization SupportSLD="1" UserLayer="1" UserStyle="1" RemoteWFS="1"/> in the getcapabilities response, you need UserStyle to not equal 0.

In both cases this will only work if the server in question supports that functionality.

  • Thanks a lot! Now i will try to find out solution with WFS layers and receive them as JSON objects in order to set styles for icon. But, by the way, how could i know if this WMS service supports SLD file ? And Where to know how to structure SLD ?
    – Vlad.d
    May 24, 2018 at 15:00
  • Thanks for the full answer! it really takes me time to understand all WMS possibilities, now it's clear.
    – Vlad.d
    May 24, 2018 at 15:05
  • don't forget to accept the answer if it solves your problem
    – Ian Turton
    May 24, 2018 at 15:06

Your Answer

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

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