Reputation: 506
I want to add a wms-overlay to an existing openlayers-map on a website. The layer is stored on geoserver. When i open the layer on geoserver, it works just fine. The data itself is in EPSG:31297.
But when i load the website openlayers is empty. Although the layer is shown in the layerswitcher.
I know there are a few questions concerning that topic, usually it had something to do with the project. However, in this case the projection should be fine. I can't figure out why it doesn't work.
Here is the code:
// My layer
var wms_layer = new OpenLayers.Layer.WMS (
"Layer",
"http://.../geoserver/wms",
{
layers: "master:dauersied_2mio",
transparent: "true",
projection: "EPSG:3857"
},
{isBaseLayer: false}
);
map.addLayer(wms_layer);
Upvotes: 2
Views: 3428
Reputation: 506
I totally forgot to declare a projection when initializing the map object. Now it works like a charm.
map = new OpenLayers.Map('map', {
projection: new OpenLayers.Projection("EPSG:3857")
});
Upvotes: 1