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

Andreas Hocevar ahocevar at opengeo.org
Tue Aug 24 09:38:25 EDT 2010


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
>>>> 
>>>> 
>>> _______________________________________________
>>> Dev mailing list
>>> Dev at openlayers.org
>>> http://openlayers.org/mailman/listinfo/dev
>>> 
>> 
> 
> 
> -- 
> 
>   .................................................................
>    Karten im (Inter|Intra)net?
> 
>    OpenLayers - Webentwicklung mit dynamischen Karten und Geodaten
>    von M. Jansen und T. Adams, OpenSourcePress, München.
> 
>    ISBN: 978-3-937514-92-5
>    URL:  http://openlayers-buch.de
>   .................................................................
> 
> 
>   Dipl.-Geogr. Marc Jansen
>   - Anwendungsentwickler -
> 
>   terrestris GmbH&  Co. KG
>   Irmintrudisstraße 17
>   53111 Bonn
> 
>   Tel:    ++49 (0)228 / 96 28 99 -53
>   Fax:    ++49 (0)228 / 96 28 99 -57
> 
>   Email:  jansen at terrestris.de
>   Web:    http://www.terrestris.de
> 
>   Amtsgericht Bonn, HRA 6835
>   Komplementärin:  terrestris Verwaltungsgesellschaft mbH
>   vertreten durch: Hinrich Paulsen, Till Adams
> 
> 
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users

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




More information about the Users mailing list