This example shows how to add a graticule overlay to a map.
<!DOCTYPE html> <html> <head> <title>Graticule example</title> <script src="https://code.jquery.com/jquery-1.11.2.min.js"></script> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css"> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script> <link rel="stylesheet" href="http://openlayers.org/en/3.8.1/css/ol.css" type="text/css"> <script src="http://openlayers.org/en/3.8.1/build/ol.js"></script> </head> <body> <div class="container-fluid"> <div class="row-fluid"> <div class="span12"> <div id="map" class="map"></div> </div> </div> </div> <script> var map = new ol.Map({ layers: [ new ol.layer.Tile({ source: new ol.source.OSM() }) ], renderer: 'canvas', target: 'map', view: new ol.View({ center: ol.proj.fromLonLat([4.8, 47.75]), zoom: 5 }) }); // Create the graticule component var graticule = new ol.Graticule({ // the style to use for the lines, optional. strokeStyle: new ol.style.Stroke({ color: 'rgba(255,120,0,0.9)', width: 2, lineDash: [0.5, 4] }) }); graticule.setMap(map); </script> </body> </html>