[OpenLayers-Dev] Base Layer vs. Main layer

Paul Spencer pspencer at dmsolutions.ca
Wed Nov 19 12:55:31 EST 2008

Hi Kenneth,

in a simplistic view of the world, there are two types of layers that  
OpenLayers deals with - opaque and non-opaque.  Opaque layers will  
obscure anything 'beneath' them because they are ... er, opaque ;)   
This is what OpenLayers calls a base layer.  Because only one can be  
seen at a time, all base layers are considered to be mutually  
exclusive and non-visible ones are turned off for performance reasons.

I don't believe that modifying OpenLayers to add another type of layer  
will benefit the code base at all.  I don't think it is clear to me  
why the current way OpenLayers works is making it difficult for you to  
do what you want to do.  Could you explain your use case please?


On 19-Nov-08, at 12:16 PM, Kenneth Skovhede, GEOGRAF A/S wrote:

> 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
> _______________________________________________
> Dev mailing list
> Dev at openlayers.org
> http://openlayers.org/mailman/listinfo/dev


    Paul Spencer
    Chief Technology Officer
    DM Solutions Group Inc

More information about the Dev mailing list