I have a client application, "talking" to my GeoWebCache service (using TMS), showing a map. The map is built out or a few raster layers. I need to show only one of them a time - depending on the zoom level (scale), one of the layers should be shown - the rest not visible.

The client can use only one "link" to access the map - I cannot switch the layers on the client.

I created a group layer on GeoServer (2.1.4) built out of the two layers I am using (250k and StreetView from OS). I cannot see any way to specify that one of them should be seen when the scale is less then N and the other otherwise. I tried a style for raster layer, specifying opacity depending on the scale, but it does not seem to work.

How is it done on GeoServer?

If it is doable on GeoWebCache level, that would be fine too. I successfully added the layers to geowebcache.xml file (I need the EPSG:27700 projection, that is why the config was needed), but cannot find a way of saying "use this WMS URL when scale is less than N".

---- UPDATE after the answer - the solution ----

I have two styles created, called raster-0-50k and raster-50k-up. Here is the first one of them, which I applied to the layer at the bottom of the stack (the top one in the list of the group layer):

    <!-- Styles can have names, titles and abstracts -->
      <Title>Raster 0 to 50k</Title>
      <Abstract>Raster, showing scale 0 to 50000</Abstract>
      <!-- FeatureTypeStyles describe how to render different features -->
      <!-- A FeatureTypeStyle for rendering rasters -->
          <Title>Opaque Raster</Title>
          <Abstract>A raster with 100% opacity</Abstract>

the other style does exactly opposite - sets opacity to 1 for scale 50k and higher. In the group layer's list, I associated the two styles with my two layers.

It does work now.

  • Please don’t use the area reserved for your question to write a solution. That should be written as a self-answer in the area reserved for answers instead.
    – PolyGeo
    Commented Feb 1 at 7:11

1 Answer 1


You need to specify a min/max scale denominator in your SLD files. Use the same figure in each style, that is the max in one is the min in the other, so that only one layer is drawn at any scale. Then combine the layers in a layer group and away you go. See http://docs.geoserver.org/stable/en/user/styling/sld/reference/rules.html#scale-selection for more details on the syntax.


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