I'm a bit stumped trying to read a EPSG:4326 WMS into a OpenLayers 3 project that's using the default 3857 (Web Mercator) projection.
I'm trying to pull a WMS layer that only supports EPSG:4326, but the projection
option for ImageWMS
appears to be "experimental" (http://openlayers.org/en/master/apidoc/ol.source.ImageWMS.html).
Lets say I have the below. The second layer is WGS84, but the first is 3857. How do I get it to work? Is this possible with OL3? I've not found any examples with it yet.
var layers = [
//Default 3857 layer
new ol.layer.Tile({
source: new ol.source.MapQuest({layer: 'sat'})
}),
//This layer is in WGS84 (EPSG:4326)
new ol.layer.Image({
extent: [0, 40, 10, 50],
source: new ol.source.ImageWMS({
url: 'http://demo.boundlessgeo.com/geoserver/wms',
params: {'LAYERS': 'topp:states'},
serverType: 'geoserver'
})
})
];
var map = new ol.Map({
layers: layers,
target: 'map',
view: new ol.View({
center: [-10997148, 4569099],
zoom: 4
})
});