[Geoprisma-dev] LegendPanel and GetLegendGraphic requests

Alexandre Dube adube at mapgears.com
Fri Oct 15 08:32:17 EDT 2010


Hi Etienne,

   Thanks for your comments.

   For the record : the LegendPanel widget has never been entirely 
completed because of some issues that were never mentioned anywhere (not 
in tickets, not in the list).  So far, it has never been used and should 
have been marked as "unfinished".  Fixing the issues you mentioned would 
be a good step forward for this widget to become 'usable'.

   A tip : you could try to configure a demo using this widget out of 
GeoPrisma (with GeoExt only).  That way, you would learn how it should 
be configured and if GeoPrisma uses it the right way.  If the issues you 
mentioned are also there while using GeoExt only, then the issues should 
be reported to GeoExt (with the according tickets/fixes).

   About the GeoExt LayerTree, Julien and I had a discussion here about 
its integration in GeoPrisma and the deprecation of the MapFishLayerTree 
widget.  We're waiting for a positive reply (including funding) to 
develop this widget.  We'll let you know as soon as we have news about this.

Regards,

Alexandre


On 10-10-14 05:12 PM, Etienne Dube wrote:
>  Hi list,
>
> In one of our projects, we noticed an issue with the behavior of the 
> LegendPanel widget. This is for a map which has many layers, but only 
> a few of them are initially visible. However, we noticed that when the 
> LegendPanel widget is added to a workspace, GetLegendGraphic requests 
> are issued for every WMS layer, even if these layers are invisible.
>
> Looking at the code, I noticed that the GeoExt LegendPanel takes every 
> layer in the Map widget and creates LayerLegend objects, whatever the 
> visibility of the layer is. These LayerLegend (in occurrence WMSLayer 
> objects) for invisible layers are added as invisible divs in the 
> legend panel, with the src of the contained img element pointing to 
> the GetLegendGraphic URL for the layer. So in effect, these images are 
> loaded from the server even if they're not displayed, which is far 
> from optimal.
>
> Any idea for what would be the best way to change this behavior? I can 
> suggest two possibilities:
>
> - What about a GeoExt-based LayerTree? It could manage its own store 
> for visible layers, and the LegendPanel could attach to this store in 
> order to manage only LayerLegend objects for layers that are really 
> visible. However I don't know enough about GeoExt to say if it's easy 
> to do.
>
> - We could modify or subclass LegendPanel, so that it instanciates 
> LayerLegend objects only for visible layers. The handler for update 
> events on the layer store (which is triggered when a layer changes 
> visibility) would have to add/remove LayerLegends depending on the 
> visibility status of each layer.
>
> Thanks,
>
> Etienne
>
>


-- 
Alexandre Dubé
Mapgears
www.mapgears.com




More information about the Geoprisma-dev mailing list