[OpenLayers-Dev] Base Layer vs. Main layer

Kenneth Skovhede, GEOGRAF A/S ks at geograf.dk
Wed Nov 19 12:16:29 EST 2008


In a map, the layer assigned as "baseLayer" is used to extract many 
properties, eg. zoomlevels etc.
In that respect is does not make sense to have multiple "baseLayers", 
but I would prefer to call it "mainLayer".

The term "base layer" is generally used to describe any layer that is 
below theming, eg. an aerial image.
I can see from questions on the users list that others get confused by 
the term "base layer" as well.

When adding a base-but-not-main-layer to a map, OpenLayers makes it 
appear on top of the "main layer".
The culprit is the "setLayerZIndex" function of Map.js:781.
In that function it is assumed that any layer that is not a "baseLayer" 
is an overlay.
I belive this assumption is wrong. It is quite natural to have multiple 
base layers, but only one main layer.
It does not work if one tries to have multiple layers with the 
"baseLayer" attribute on, because OpenLayers
assumes that only one "baseLayer" is visible at a time.

For MapGuide layers, this is very annoying because one may have multipe 
tiled base layers
(yes they are named that in MapGuide) that are stacked (png's), and one 
"main layer" (named dynamic overlay)
which is actually not a "base layer".

A suggested fix would be to add two properties, namely baseLayer and 
mainLayer.
I can see that this would break quite a lot of code, so it is likely not 
a usefull suggestion.

The fix I use myself, is to manually set the ZIndex but since it is 
non-standard, it will
likely break at some point, if OpenLayers decides to reset the layer order.

Comments are appreciated.

-- 
Regards, Kenneth Skovhede, GEOGRAF A/S





More information about the Dev mailing list