[OpenLayers-Dev] Web Map Context confusions

Andreas Hocevar ahocevar at opengeo.org
Sat Jul 11 15:29:08 EDT 2009

Hi Trond,
Trond Michelsen wrote:
> I'm looking at OpenLayers.Format.WMC, and I'm a little bit confused
> about the mergeContextToMap function.
>     mergeContextToMap: function(context, map) {
>         map.addLayers(context.layers);
>         return map;
>     },
> Is this even useful? Just adding layers to the map without checking if
> they're already there? Shouldn't merge alter the state of existing
> layers, and then add whatever new layers the context document offers?

Web Map Context is a standard to persist or exchange a map view. Given 
the use case that you populate a map with the layers from a context, 
change the context externally and want to update the map, it would 
probably be useful to change the method.

Since mergeContextToMap is not an APIMethod, it should be no problem to 
change it.


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

More information about the Dev mailing list