[Geoprisma-dev] LegendPanel and GetLegendGraphic requests

Etienne Dube etienne.dube at boreal-is.com
Fri Oct 15 17:41:35 EDT 2010


  Hi Alexandre,

I did the test you suggested using GeoExt 1.0 and OL 2.10, now the 
behavior is that while LayerLegend objects are created (and the legend 
images initially loaded) for invisible layers, doing a zoom-in/out 
doesn't trigger any update events on invisible layers. So effectively 
GetLegendGraphic requests are not issued for invisible layers on 
zoom-in/out actions, which is far better.

The project in question uses an older rev of GeoPrisma (r805), I should 
try upgrading to the head rev (along with newer GeoExt and OL libs) to 
see if we still have this issue.

Thanks for your help,

Etienne



On 15/10/2010 8:32 AM, Alexandre Dube wrote:
> 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
>>
>>
>
>


-- 
Etienne Dubé
Consultant / Développeur

Boréal Informations Stratégiques
101, Du Moulin, bureau 202-A
Magog (Québec)
J1X 4A1

Tel. :  514.313.5951 #1131
Courriel: etienne.dube at boreal-is.com




More information about the Geoprisma-dev mailing list