[OpenLayers-Users] URL Too Long for GetLegendGraphics WMS Get Request

Andreas Hocevar ahocevar at opengeo.org
Mon Feb 20 09:57:41 EST 2012


Hi,

with "reconfigure the legend type selection sequence", I meant that
you should configure your LegendPanel with

preferredTypes: ["gx_vectorlegend"]

In addition to that, the legend for your layer needs to be configured
with the rules of your SLD. So whenever you update your filter, you
have to do something like

legendPanel.items.each(function(cmp) {
    if (cmp.getXType() == "gx_vectorlegend") {
        cmp.rules = mySldRules;
        cmp.update();
    }
});

This is untested, but I hope it's enough for you to get the picture.

Andreas.

On Sat, Feb 18, 2012 at 12:46 AM, jdgodchaux <jd at nijel.org> wrote:
> Hello,
>
> I'm using OpenLayers, GeoExt and Geoserver to create a simple map with a
> MapPanel, LegendPanel, and LayerTree. I'm using a standard
> OpenLayers.Layer.WMS instance to add a new layer to this map and I'm
> applying several filters to this layer to only display a small number
> features. With a large number of filters applied, the GetMap request URL is
> too long for a GET request, so I've applied tileOptions: {maxGetUrlLength:
> 2048} in the OpenLayers.Layer.WMS instance and the system is now using POST
> with no problems. My data appear on the map pane filtered and styled as I've
> requested (I've set the style through Geoserver; sld in the Geoserver data
> directory).
>
> The problem I'm running into now is that while the GetMap request is using
> POST, the GetLegendGraphics request to populate the legend is still using
> GET and the URL is way to long for a GET request. Does anyone know of a way
> in OpenLayers/GeoExt to shorten GetLegendGraphics request URL? Is there some
> way to remove the filters from the GetLegendGraphics request and still keep
> them in the GetMap request?
>
> I did see a somewhat related post here
> (http://osgeo-org.1560.n6.nabble.com/mergeNewParams-Legend-td3926069.html).
> Here Andreas suggested to "reconfigure the legend type selection sequence,
> so a VectorLegend rather than a WMSLegend is created," but I couldn't really
> translate how to implement the solution Andreas provided.
>
> Many thanks in advance!!
> JD
>
>
>
> --
> View this message in context: http://osgeo-org.1560.n6.nabble.com/URL-Too-Long-for-GetLegendGraphics-WMS-Get-Request-tp4481884p4481884.html
> Sent from the OpenLayers Users mailing list archive at Nabble.com.
> _______________________________________________
> Users mailing list
> Users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-users



-- 
Andreas Hocevar
OpenGeo - http://opengeo.org/
Expert service straight from the developers.


More information about the Users mailing list