three/RemoveOverlayBaseLayerDichotomy

Remove (or Reduce) Overlay / Base Layer Dichotomy

Currently, if a layer's isBaseLayer property is true, several things are implied:

  • When the layer is visible, no other layers with isBaseLayer true can be visible. This implies that the layer is part of a group in which the visibility choice is mutually exclusive.
  • When the layer is visible its projection and resolutions are used in requesting all other layers. This implies that if isBaseLayer is false, a layer can be displayed at any resolution in any projection.

The couping of these two characteristics of the isBaseLayer property forces some awkwardness in the following situations:

  • Given a set of layers, the user wants to be able to turn on any number of them (including none).
  • Given a set of layers, the user wants to be able to display them in any draw order.

Layer Groups

One way to provide a bit of flexibility would be to introduce layer groups. The current behavior implies two groups: base layers and overlays. It also enforces an "exclusive visibility" property on the base group. We could allow for arbitrary layer groups, and we could allow people to decide whether a group was exclusive with regard to layer visibility. Having two groups by default (overlay and base) and setting exclusive layer visibility on the base group would provide functionality similar to what we have currently.

If layer groups are appealing, they should really be described in a different proposal.

Fixed Resolutions

There are a number of tile sources that only provide a fixed set of resolutions. Layers should have a property that advertises whether or not they provide a fixed set of resolutions. This property is not necessarily coupled with the exclusive visibility property, or with the grouping at the base of the draw order. If no layers have fixed resolutions, the maps zoomFactor (or similarly named) property could be used to determine how much resolution changes with a zoomIn or zoomOut call.

Fixed Projection

A number of rendering or feature services only provide a limited set of projections. We could have a layer property that allowed users to set a limited set of supported projections. We could also decide that there is not much use for switching projections on a single map, and that an application should not be configured to have layers that don't support the desired projection. The current uses of this are our examples switching between a commercial provider (in spherical mercator) and a public wms (in geographic/wgs84). This is probably also something that deserves its own discussion thread.


Work In Progress

  • introduce userProjection, the projection the user manipulates
  • userProjection defaults to "EPSG:4326" (in the map)
  • user doesn't have to provide units, rely on projection.getUnits() internally
new OpenLayers.Map({
   div: "map",
   layers: new OpenLayers.Layer.Google(),
   center: [5, 45]
});
new OpenLayers.Map({
    div: "map",
    layers: new OpenLayers.Layer.WMS({
        url: "url",
        layers: "layer1,layer2"
    })
)};