OpenLayers 3 Beginner’s Guide

Using different projection codes

Open sample in a new windows

<!doctype html>
<html>
  <head>
    <title>WMS projection with WGS84</title>
    <link rel="stylesheet" href="../assets/ol3/css/ol.css" type="text/css" />
    <link rel="stylesheet" href="../assets/css/samples.css" type="text/css" />
  </head>
  <body>
    <div id="map" class="map"></div>
    <script src="../assets/ol3/js/ol.js"></script>
    <script>
        var blueMarbleLayer = new ol.layer.Tile({
      source: new ol.source.TileWMS({
        url: 'http://maps.boundlessgeo.com/geowebcache/service/wms',
        params: {
          'TILED' : true,
          'VERSION': '1.1.1',
          'LAYERS': 'bluemarble',
          'FORMAT': 'image/jpeg'
        }
      })
    });

        var view = new ol.View({
      projection: 'EPSG:4326',
      center: [-1.81185, 52.443141],
      zoom: 6
    });

        var map = new ol.Map({
      target: 'map'
    });

    map.addLayer(blueMarbleLayer);

    map.setView(view);

    </script>
  </body>
</html>