[OpenLayers-Dev] A kind of MultiLayer container

Alexandre Dube adube at mapgears.com
Mon Aug 3 14:43:44 EDT 2009


Hi Ivan,

Here's my thoughts on that topic :

Like you said, I also did something similar. I had 4 different data 
sources that were normalized and had to use 4 Vector layers with 
"moveend" events to automatically switch from one to an other.

What I though to be 'a bad idea' was to have 4 layers (all of the same 
kind, i.e. Vector) for a slight difference. That's why the OptionByZoom 
Strategy I then made (1) was better.

What you're seeking to do is different. Switching from a WMS layer to a 
Vector layer can't be done by 'switching properties' of one layer. IMHO, 
you currently can't avoid having multiple layers for that, so your idea 
of a 'container' could be good. That doesn't need to be much 
complicated. You could have a dummy layer with inLayerSwitcher: true 
that could be your container for other layers. It could have 
properties/features like:
layers (the layers to have together)
currentLayer (set on each "moveend" events of layers)
setCurrentLayer() (set the current inRange layer from layers, only one 
should be inRange at a time)
addLayer() (automatic map.addLayer, "moveend" event registration to 
setCurrentLayer, etc.)

and added layers should have min/max Scale/Resolution properties to have 
unique ranges.

What do you think ?

Alexandre

(1) http://dev4.mapgears.com/bdga/options-by-zoom-bdga.html

Ivan Grcic wrote:
> Hi devs,
>
> I want to ask if anyone has made something like Vector/RootContainer,
> a layer that would contain several layers, and every layer would
> activate/deactivate on different zoomLevels.
>
> Simple case: 3 (or more) layers combined in one ContainerLayer
> small scale: WMS raster layer
> larger scales: other WMS  raster layer
> large scale: WFS vector layer
>
>  Usually I always register zoomend event on map, and manually activate
> or deactivate layers...but it got little bit boring to do that on
> application level every time.
>
> I remember Alexandre did something like that but for Vector layer
>  or http://openlayers.org/pipermail/users/2009-January/009666.html
>
> Anyone did something like that? (does mapfish maybe has soemthing like that)
>  If not, can anyone just give few tips, so I could start developing it...
>
> Tnx&Cheers,
>
>
>   


-- 
Alexandre Dubé
Mapgears
www.mapgears.com




More information about the Dev mailing list