I spent hours trying to figure out the following problem, I hope someone can help me.
You can see here that this WMS has different Projections available: http://www.webatlasde.de/arcgis/services/Maps4BW/MapServer/WMSServer?SERVICE=WMS&request=GetCapabilities
(here you can find even more information and an example map http://www.webatlasde.de/ArcGIS/rest/services/Maps4BW/MapServer )
How do I have to set up my map-object or layers so that the webatlas.de and OSM (or Google) are displayed in one Map with the correct projection?
Can't I use EPSG:3857 as an substitut for EPSG:900913?
In fact I can only get webaltas.de working without spatial distortion with the following configuration:
Proj4js.defs["EPSG:31467"] = "+proj=tmerc +lat_0=0 +lon_0=9 +k=1 +x_0=3500000 +y_0=0 +ellps=bessel +datum=potsdam +units=m +no_defs";
var extent1 = new OpenLayers.Bounds(3364573, 5257369, 3635262, 5536211);
function Map_main(){
map = new OpenLayers.Map("mapdiv",{
projection: new OpenLayers.Projection('EPSG:31467'),
displayProjection: new OpenLayers.Projection('EPSG:31467'),
controls: [new OpenLayers.Control.Navigation(),
new OpenLayers.Control.PanZoomBar(),
new OpenLayers.Control.ScaleLine({ bottomOutUnits:'',bottomInUnits:'',maxWidth:150}),
new OpenLayers.Control.MousePosition(),
new OpenLayers.Control.LayerSwitcher()],
units: "m",
maxExtent: extent1
});
webatlasde = new OpenLayers.Layer.WMS("Webatlas", "http://www.webatlasde.de/arcgis/services/Maps4BW/MapServer/WMSServer", {
layers: 'Halbtonvariante',
format: 'image/png'
});
map.addLayer(webatlasde);
}
If I try this, the map is distorted
Proj4js.defs["EPSG:31467"] = "+proj=tmerc +lat_0=0 +lon_0=9 +k=1 +x_0=3500000 +y_0=0 +ellps=bessel +datum=potsdam +units=m +no_defs";
var leftBottom = new OpenLayers.LonLat(3364573, 5257369).transform(new OpenLayers.Projection("EPSG:31467"), new OpenLayers.Projection("EPSG:4326") );
var rightTop = new OpenLayers.LonLat(3635262, 5536211).transform(new OpenLayers.Projection("EPSG:31467"), new OpenLayers.Projection("EPSG:4326") );
var extent2 = new OpenLayers.Bounds(leftBottom.lon, leftBottom.lat, rightTop.lon, rightTop.lat);
function Map_main2(){
map = new OpenLayers.Map("mapdiv",{
projection: new OpenLayers.Projection('EPSG:4326'),
displayProjection: new OpenLayers.Projection('EPSG:4326'),
controls: [new OpenLayers.Control.Navigation(),
new OpenLayers.Control.PanZoomBar(),
new OpenLayers.Control.ScaleLine({ bottomOutUnits:'',bottomInUnits:'',maxWidth:150}),
new OpenLayers.Control.MousePosition(),
new OpenLayers.Control.LayerSwitcher()],
units: "m",
maxExtent: extent2
});
webatlasde = new OpenLayers.Layer.WMS("Webatlas", "http://www.webatlasde.de/arcgis/services/Maps4BW/MapServer/WMSServer", {
layers: 'Halbtonvariante',
projection: new OpenLayers.Projection('EPSG:31467'),
displayProjection: new OpenLayers.Projection('EPSG:4326'),
format: 'image/png'
});
map.addLayer(webatlasde);
}
Can someone tell me how to correctly change the projection for the webatlas.de WMS? Or do I even have to use its REST-Interface with OpenLayers (I tried but miserably failed)?
I hope I could make explain myself.
Have a nice day! All the best Gregor