[OpenLayers-Users] Permalink doesn't update on addlayer/removelayer

Marc Jansen jansen at terrestris.de
Tue Aug 24 09:49:48 EDT 2010


Hi Andreas,

your example convinced me. I think the proposed addition/change might 
indeed lead to more confusion instead of more clarity/intuitive behaviour.

Thanks for discussing this.

Cheers,
Marc


On 24.08.2010 15:38, Andreas Hocevar wrote:
> On Aug 24, 2010, at 15:15 , Marc Jansen wrote:
>
>    
>> Hi Andreas,
>>
>> first of all, sorry for cross-posting in the past. I thought it was
>> useful in this case.
>>
>> I'd disagree about the not handling of the layeradd/layerremove event
>> for the Permalink-control -- but can easily live without this addition
>> to OpenLayers :-)
>>
>> Your suggestions of alternative ways of handling application "state" are
>> valid and often better suited, yet I think the addition of two
>> additional listeners to the control would be very intuitive.
>>      
> This is where I have to disagree. Let's say you have a map with two pre-configured layers. Now user A, who uses the Permalink control as is, adds a layer, resulting in a permalink with "&layers=BT".
>
> User B has the same map, adds a completely different layer, but uses your add/removelayer aware Permalink control, resulting in a permalink with "&layers=BTT".
>
> Now the interesting part comes when both users send this permalink to someone who opens the permalink. That person will see exactly the same layers with both permalinks - because the map will load only the two pre-configured layers.
>
> This is why I wouldn't consider adding add/removelayer handlers to the Permalink control useful or intuitive at all.
>
> Regards,
> Andreas.
>
>    
>> Best regards,
>>
>> Marc
>>
>>
>>
>> On 24.08.2010 14:49, Andreas Hocevar wrote:
>>      
>>> Hi,
>>>
>>> first of all, please don't cross-post dev and users.
>>>
>>> I am not sure if a permalink as provided by OpenLayers is what you really want for applications where the user can add or remove layers. The permalink only stores the visible/invisible state of the available layers in their order. It does not know anything about what these layers are. So a permalink will look exactly the same for any map with the same extent with let's say 3 layers that are all visible.
>>>
>>> If you want to store information on what layers are actually configured, you should look into Format.WMC, Format.OWS or solutions like the OpenGeo Suite's GeoExplorer (http://suite.opengeo.org/geoexplorer), which stores layer configurations in a database and provides a permalink with a map id.
>>>
>>> Regards,
>>> Andreas.
>>>
>>> On Aug 24, 2010, at 14:31 , Marc Jansen wrote:
>>>
>>>
>>>        
>>>> Hi Slawomir,
>>>>
>>>> I'd consider this a bug with a (on first sight) reasonable easy fix:
>>>>
>>>> In the Permalinks draw-method:
>>>>
>>>>          this.map.events.on({
>>>>              'moveend': this.updateLink,
>>>>              'changelayer': this.updateLink,
>>>>              'changebaselayer': this.updateLink,
>>>>              'addlayer': this.updateLink,
>>>>              'removelayer': this.updateLink,
>>>>              scope: this
>>>>          });
>>>>
>>>> Or one could think of triggering a changelayer event when a layer has
>>>> been added/removed in Map.js.
>>>>
>>>> I am unsure which design is better, so I'd suggest opening up a ticket
>>>> (I cc'ed the developer list so the core developers notice this discussion).
>>>>
>>>> Regards,
>>>> Marc
>>>>
>>>>
>>>>
>>>>
>>>> On 24.08.2010 13:53, Slawomir Messner wrote:
>>>>
>>>>          
>>>>>    Hello,
>>>>> Does anyone know why Permalink doesn't listen to addlayer/removelayer?
>>>>> Every time I add a new layer I have to change a property(i.e.
>>>>> visibility) to refresh the link. It's a bug or a feature?
>>>>> Regards,
>>>>> Slawomir
>>>>>
>>>>>
>>>>>            




More information about the Users mailing list