I'm trying to load a WMS in my application, but I get the following error:
400 (Bad Request)
Confusingly enough I still get an empty image.
The corresponding request is:
http://sg.geodatenzentrum.de/wms_dop40?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&FORMAT=image/png&TRANSPARENT=true&LAYERS=rgb&WIDTH=256&HEIGHT=256&SRS=EPSG:4326&STYLES=&BBOX=112.5,33.75,123.75,45
I've tried setting layer projection parameters to 3857, 4326, 900913 and 25832 but none worked. QGIS also doesn't seem to like the WMS either. So I tried simple getMap requests in my browser and the following worked:
http://sg.geodatenzentrum.de/wms_dop40?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&FORMAT=image/png&TRANSPARENT=true&LAYERS=rgb&WIDTH=256&HEIGHT=256&SRS=EPSG:4326&STYLES=&BBOX=5.625,50.625,11.25,56.25
The only difference I could find was a different BBOX parameter.
Does Openlayers create a wrong BBOX parameter or what do I have to change in my code?
var view = new ol.View({
center: ol.proj.fromLonLat([10, 51]),
zoom: 6,
maxZoom: 11,
projection: 'EPSG:3857'
});
var luftbilder = new ol.layer.Tile({
source: new ol.source.TileWMS({
url: 'http://sg.geodatenzentrum.de/wms_dop40?',
params: {'LAYERS': 'rgb',
'VERSION': '1.1.1',
},
projection: 'EPSG:4326'
})
});
var map = new ol.Map({
target: 'map',
view: view,
layers: [luftbilder]
});
weird, fiddle works fine fiddle (in Chrome)