I have successfully created a new vector layer in my GeoServer 2.10.4. It shall be displayed on top of a basemap and an additional raster layer, but it displays below the raster. I want this order:

  1. Basemap
  2. Raster
  3. Vector

But got this one:

  1. Basemap
  2. Vector
  3. Raster

How can I change this, so the vector layer always sits on top of everything else? From various similar questions I found that it should be achievable using the SLD of the layer and inserting z-order=X somewhere, so here is my SLD for this particular layer. I tried values of 0, 1 and 99 so far, all with the same result.

<?xml version="1.0" encoding="UTF-8"?>
<StyledLayerDescriptor version="1.0.0" 
 xsi:schemaLocation="http://www.opengis.net/sld StyledLayerDescriptor.xsd" 
  <!-- a Named Layer is the basic building block of an SLD document -->
    <!-- Styles can have names, titles and abstracts -->
      <Title>Default Polygon</Title>
      <Abstract>A sample style that draws a polygon</Abstract>
      <!-- FeatureTypeStyles describe how to render different features -->
      <!-- A FeatureTypeStyle for rendering polygons -->
          <Title>Red Polygon with Black Outline</Title>
          <Abstract>A polygon with a red fill and a 1 pixel black outline</Abstract>
              <CssParameter name="fill">#ff0000</CssParameter>
              <CssParameter name="stroke">#000000</CssParameter>
              <CssParameter name="stroke-width">1</CssParameter>
              <CssParameter name="z-index">99</CssParameter>
  • Currently supported versions are 2.13.2 and 2.12.5, and 2.14 will soon be there. You should consider an upgrade. – pLumo Sep 17 '18 at 12:19

The SLD Z-order is used to determine the order that features are drawn in the layer not the order of the layers. The layer order is controlled by the client that you are using, it needs to make the requests in the correct order.

  • 1
    true, or from the Layer Group configuration. – pLumo Sep 17 '18 at 12:19
  • Understood. So how can I achieve this then? Sorry, but I'm very new to GeoServer and we only have this version installed at the moment. – s6hebern Sep 17 '18 at 12:24
  • 1
    you need to add details of the client you are using to the question – Ian Turton Sep 17 '18 at 12:40

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.