[OpenLayers-Dev] Base Layer vs. Main layer

Christopher Schmidt crschmidt at metacarta.com
Wed Nov 19 14:22:58 EST 2008


On Wed, Nov 19, 2008 at 08:04:39PM +0100, Kenneth Skovhede, GEOGRAF A/S wrote:
> Very nice explanations!
> The Wiki page explains the problem quite well.
> I wish I had found that page a long time ago.
> 
> Just to carve it in stone, I would like my layer stack to look like this:
> 
> [Vector] -> OpenLayers vector layer
> [Selection] -> Transparent PNG, rendered dynamically by MapGuide
> [Dynamic Overlay] -> Main layer with bounds, etc. Also displays 
> thematics from MapGuide, eg Election districts.
> [Base layer 1] -> Transparent PNG with things like lakes etc that are 
> not easily visible on an aerial
> [Base layer 2] -> Transparent PNG with things building outlines, road 
> names etc.
> [Base layer 3] -> Aerial JPG (opaque)
> 
> This enables the user to turn off building outlines without having to 
> reload the aerial.
> It also enables the user to toggle different thematics on and off 
> without reloading the aerial or building outlines.
> (It obviously costs more server calls to have the division).
> 
> As I see it, my "Vector" and "Selection" are clearly overlays, where as 
> the "Dynamic Overlay" is the main layer.
> Currently I have to assign this as the "baseLayer" because it has all 
> the required info (units, bounds, etc.)

Since all of these layers are in the same projectino (since OpenLayers
has no way of doing anything else) I don't see that this is actually
required. 

Instead, what I would recmomed you do is simply create an empty base
layer:

  new OpenLayers.Layer("", {displayInLayerSwitcher:false, 
  isBaseLayer: true,
  maxExtent:,  maxResolution, etc.});

This  layer would be the only base layer.

Then, all the other layers can be used in any way you want.

How does this not work for your situation?

> Perhaps a real solution would be to follow the tracks of:
> http://trac.openlayers.org/ticket/1096
> But add a property named "isBottomLayer" instead to allow compatibility 
> with the existing code.

I don't understand what you mean, but I do not expect that any changes
will be made in this regard before 3.0.

Regards,
-- 
Christopher Schmidt
MetaCarta



More information about the Dev mailing list