[OpenLayers-Users] Multiple layers display
Christopher Schmidt
crschmidt at metacarta.com
Fri Aug 15 07:12:24 EDT 2008
On Fri, Aug 15, 2008 at 08:26:19AM +0300, Lehtonen, Mika wrote:
> Hi Greg,
> I believe you need to add layers with:
>
> map.addLayers([stationsLayer,wms]);
>
> instead of separate addLayer, though I am not sure if this is the thing
> preventing both layers to appear.
These two actually work exactly the same, so that's not it.
> Greg Ederer kirjoitti:
> > Oh, and here's my code:
> >
> > wms = new OpenLayers.Layer.WMS(
> > "esv:countries - Tiled", "http://localhost:8080/geoserver/wms",
<Snip>
> >
> > map.addLayer(stationsLayer);
> >
> > map.addLayer(wms);
> >
Neither of your layers is an 'overlay'/non baseLayer.
You should set 'transparent': true on one layer's parameters (3rd hash)
or 'isBaseLayer': false to one layer's options (fourth hash).
Either of these should make the layer an 'overlay'.
Only one base layer should be visible on a map at once.
Adding a Control.LayerSwitcher would allow you to switch between them.
Regards,
--
Christopher Schmidt
MetaCarta
More information about the Users
mailing list