[OpenLayers-Dev] Base Layer vs. Main layer
crschmidt at metacarta.com
Wed Nov 19 13:26:36 EST 2008
On Wed, Nov 19, 2008 at 12:55:31PM -0500, Paul Spencer wrote:
> 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?
It's pretty simple:
* I have OAM and OSM on my map.
* I want to be able to turn either of them on or off (like overlays)
* I don't have another 'base' layer which defines the projection.
Essentially, these types of 'base' layers -- layers which are always at
the bottom, no matter how they're added to the map -- don't exist.
Instead, they have to be 'overlays' over a dummy base layer, and they
have to be added first (or setLayerIndex has to be called to move them
to the bottom of the stack).
Kenneth's argument is that there should be a set of selectable layers
which lives at the bottom of the stack, but don't always need to be on.
In 3.0, I expect that all of this will be refactored -- at the very
least, it's one of the things that I know Tim has mentioned as a
significant problem for him in working with OpenLayers.
Some of the tickets related to this:
And a long, descriptive wikipage:
Essentially, the baselayer/overlay dichotomy is weird. If yu want, you
can ignore it completely. If you do, there are some things you have to
do -- like adding the layers you want displayed at the bottom first. It
sounds to me like Kenneth is suggesting we change this. It seems likely
to me that none of this is going to change -- especially given that he
already sounds like he has a workaround -- before 3.0, but that doesn't
make his complaint wrong. Our baselayer/overlay dichotomy is weird, and
at some point, we should fix it.
Just not today.
More information about the Dev