Load a QGIS-Server WMS-Layer to OpenLayers3 with manually created GetLegendGraphic image
by Thomas B.
HTML
<script src="http://openlayers.org/en/v3.1.1/build/ol.js"></script>
Load a WMS-Server-WMS-Layer to OpenLayer3
<div id="map"></div>
CSS
#map {
height: 256px;
width: 512px;
border:1px solid black;
}
JavaScript
var map = new ol.Map({
target: 'map',
renderer: 'canvas',
layers: [
/*
new ol.layer.Tile({
source: new ol.source.OSM()
}),
*/
new ol.layer.Image({
source: new ol.source.ImageWMS({
//url: 'http://www.geo.euskadi.net/arcgis/services/U11_AGS_WMS_Cartografia/MapServer/WMSServer?',
url: 'http://www.geo.euskadi.net/arcgis/services/U11_AGS_WMS_Cartografia/MapServer/WMSServer?',
ratio: 1,
params: {
'LAYERS': '1',
'TRANSPARENT': 'true'
}
})
})
],
view: new ol.View({
projection: 'EPSG:4326',
center: [-2.557379, 43.063020],
zoom:8
})
});