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" 
          <ogc:Function name="gs:CropCoverage">
            <ogc:Function name="parameter">
            <ogc:Function name="parameter">
              <ogc:Function name="env">
            <ColorMap type="values">
                <ColorMapEntry color="#e6004d" quantity="1" label="1" opacity="1"/>
                <ColorMapEntry color="#ff0000" quantity="2" label="2" opacity="1"/>

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.