[Users] Legend Panel Does Not Display Icons for Cached Layers

IT Intern itintern12 at gmail.com
Mon Nov 8 18:13:56 CET 2010


Thanks Andreas,

This thread
http://old.nabble.com/Legends-for-cached-layers--td28165899.html#a30162663along
with your feedback helped me greatly to figure out what I have to do
to get it working :)

var LayerRec;
            for(var l = 4; l < map.layers.length; l++)
            {
                LayerRec = mapPanel.layers.getAt(l);
                LayerRec.set("legendURL","
http://localhost:8080/geoserver/wms?TRANSPARENT=true&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetLegendGraphic&EXCEPTIONS=application%2Fvnd.ogc.se_xml&FORMAT=image%2Fgif&LAYER="
+ map.layers[l].params["LAYERS"]);
            }

Is the code I used.  Now I wonder though...why is the legend not able to
show me the graphic of a group layer :(.  This has never worked for me, even
when I was requesting the layers directly from the WMS server.  I appreciate
any insight on this.

Many continued thanks for your time,

elshae


On Mon, Nov 8, 2010 at 2:40 AM, Andreas Hocevar <ahocevar at opengeo.org>wrote:

> Hi,
>
> if your layer is an OpenLayers.WMS layer, GeoExt's LegendPanel will use a
> WMSLegend and issue a GetLegendGraphic request.
>
> If your layer record was copied from a WMSCapabilities store, and the
> Capabilities document includes a URI for GetLegendGraphic, it will be used.
> Otherwise the GetLegendGraphic will be built using the URL of the layer,
> which will not work for GWC.
>
> You can also create your layer records with a legendURL field. If found, a
> UrlLegend will be created instead of a WMSLegend, using that URL.
>
> Hope this helps.
>
> Regards,
> Andreas.
>
> On Nov 4, 2010, at 18:20 , IT Intern wrote:
>
> > Hello GeoExt Users,
> >
> > I've been playing with the ExtJS and GeoExt libraries for a bit and now
> have what I can call a map browser.  I was originally calling layers from
> the server and had their icons displaying in a GeoExt.LegendPanel.  Ever
> since I started using GeoWebCache to get my layers from a cache location,
> the LegendPanel does not display the icons.  I actually do not understand
> why this had any effect since my styles are still located in the same place
> as they were before.  If anyone can provide me with some insight, I'd be
> very greatful.  I have read that the LegendPanel pulls this from the WMS
> GetLegendGraphic parameter, but I do not have any idea where or how
> GeoExt.LegendPanel gets that info.  I've also seen some weird/dirty looking
> hack to override LegendPanel icons..but I couldn't make much sense of that
> either :-/
> >
> > //This is the code to my legend panel and I am wondering if it is just a
> config option I am supposed to change/set?
> > var legend = new GeoExt.LegendPanel({
> >                 region: "east",
> >                 title: "Legend",
> >                 width: 200,
> >                 autoScroll: true,
> >                 layerStore: mapPanel.layers
> >             });
> >
> > Thank you for your time oh wise ones :),
> >
> > elshae
> > _______________________________________________
> > Users mailing list
> > Users at geoext.org
> > http://www.geoext.org/cgi-bin/mailman/listinfo/users
>
>
>
> --
> Andreas Hocevar
> OpenGeo - http://opengeo.org/
> Expert service straight from the developers.
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.geoext.org/pipermail/users/attachments/20101108/204b2a9b/attachment-0001.htm 


More information about the Users mailing list