1

I have a geotiff file served with geoserver. The geotiff is styled with the following sld, which includes a spatial filter. I am sending a polygon geometry as an env parameter, which results in showing the part of the geotiff inside the polygon area.

<?xml version="1.0" encoding="UTF-8"?>
<StyledLayerDescriptor xmlns="http://www.opengis.net/sld" 
xmlns:ogc="http://www.opengis.net/ogc" 
xmlns:xlink="http://www.w3.org/1999/xlink" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:schemaLocation="http://www.opengis.net/sld
http://schemas.opengis.net/sld/1.0.0/StyledLayerDescriptor.xsd" 
version="1.0.0">
  <NamedLayer>
    <Name>raster_layer</Name>
    <UserStyle>
      <FeatureTypeStyle>
        <Transformation>
          <ogc:Function name="gs:CropCoverage">
            <ogc:Function name="parameter">
              <ogc:Literal>coverage</ogc:Literal>
            </ogc:Function>
            <ogc:Function name="parameter">
              <ogc:Literal>cropShape</ogc:Literal>
              <ogc:Function name="env">
                <ogc:Literal>shape</ogc:Literal>
              </ogc:Function>
            </ogc:Function>
          </ogc:Function>
        </Transformation>
        <Rule>
          <RasterSymbolizer>
            <Opacity>1.0</Opacity>
            <ColorMap type="values">
                <ColorMapEntry color="#e6004d" quantity="1" label="1" opacity="1"/>
                <ColorMapEntry color="#ff0000" quantity="2" label="2" opacity="1"/>
             </ColorMap>
          </RasterSymbolizer>
        </Rule>
      </FeatureTypeStyle>
    </UserStyle>
  </NamedLayer>
</StyledLayerDescriptor>

I request the wms layer using the following code:

L.tileLayer.wms(WMS_ROOT_URL, {
    layers: layername,
    format: 'image/png',
    transparent: true,
    version: '1.3.0',
    styles: myStyle,
    env: 'shape:' + clipPolygon
});

While this works fine with smaller polygons, the polygons can get very large and complex, resulting in thousands of characters, which gives a 414 error: Request-URI Too Long.

I am trying to find a way to fix this, but I had no success so far. What I was thinking as possible solutions were: 1. Use post in wms request 2. Send the id of the polygon instead of its geometry and somehow use this to get the polygon geometry in the sld 3. Other solution?

I am using: Geoserver v.2.11.1 and Leaflet v.1.2.0

Your Answer

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

Browse other questions tagged or ask your own question.