[GIS] OpenLayers 3: putting an image (or logo/legend) on the map

htmljavascriptopenlayers

I'm relatively new to OpenLayers. How to insert a simple image (or logo/legend) on the map?

From this example, http://jsfiddle.net/expedio/od5eLpb9/

Is it possible to overlay the legend (that in this case is a simple image) on the map?

Best Answer

Just put the <div id="legende">...</div> in <div id="map"> like below:

Load a QGIS-Server-WMS-Layer to OpenLayer3 <div id="map"><div id="legende"> <h2>Legend:</h2> <div class="udiv_legende" id="legende_1"> <img src="http://qgiscloud.com/expedio/wfs_t/wms?Service=WMS&REQUEST=GetLegendGraphic&VERSION=1.0.0&FORMAT=image/png&WIDTH=12&HEIGHT=12&LAYER=buffer"> <br> <br> </div> </div></div>

and add the styling as:

#legende{ position: absolute; z-index: 100000; }

Now you further set the size and position of lengends in CSS only. All the Best