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?

1 Answer 1


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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.